Update app.py
Browse files
app.py
CHANGED
@@ -141,12 +141,12 @@ def clear_all():
|
|
141 |
#History - die Frage oder das File eintragen...
|
142 |
def add_text(chatbot, history, prompt, file):
|
143 |
if (file == None):
|
144 |
-
chatbot
|
145 |
else:
|
146 |
if (prompt == ""):
|
147 |
-
chatbot
|
148 |
else:
|
149 |
-
chatbot
|
150 |
print("chatbot nach add_text............")
|
151 |
print(chatbot)
|
152 |
return chatbot, history, prompt, "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
|
@@ -414,15 +414,15 @@ def generate_auswahl(prompt, file, chatbot, history, rag_option, model_option, o
|
|
414 |
if (file == None):
|
415 |
result = generate_text(prompt, chatbot, history, rag_option, model_option, openai_api_key, k=3, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3,)
|
416 |
history = history + [(prompt, result)]
|
417 |
-
#Antwort als Stream ausgeben... wenn Textantwort gefordert
|
418 |
else:
|
419 |
#Es wurde ein Bild angehängt -> wenn prompt dazu, das Bild analysieren
|
420 |
#geht nur über spezielle OpenAI-Schnittstelle...
|
421 |
result= generate_text_zu_bild(file, prompt)
|
422 |
history = history + [((file,), None),(prompt, result)]
|
423 |
-
|
424 |
print("result..................")
|
425 |
print(result)
|
|
|
426 |
for character in result:
|
427 |
chatbot[-1][1] += character
|
428 |
time.sleep(0.03)
|
@@ -479,8 +479,7 @@ def generate_text (prompt, chatbot, history, rag_option, model_option, openai_ap
|
|
479 |
|
480 |
#Prompt an history anhängen und einen Text daraus machen
|
481 |
history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
|
482 |
-
|
483 |
-
print(history_text_und_prompt)
|
484 |
#history für HuggingFace Models formatieren
|
485 |
#history_text_und_prompt = generate_prompt_with_history_hf(prompt, history)
|
486 |
#history für openAi formatieren
|
|
|
141 |
#History - die Frage oder das File eintragen...
|
142 |
def add_text(chatbot, history, prompt, file):
|
143 |
if (file == None):
|
144 |
+
chatbot.append((prompt, None))
|
145 |
else:
|
146 |
if (prompt == ""):
|
147 |
+
chatbot.append(((file.name,), "Prompt fehlt!"))
|
148 |
else:
|
149 |
+
chatbot.append((file.name,), None), (prompt, None))
|
150 |
print("chatbot nach add_text............")
|
151 |
print(chatbot)
|
152 |
return chatbot, history, prompt, "" #gr.Image( label=None, size=(30,30), visible=False, scale=1) #gr.Textbox(value="", interactive=False)
|
|
|
414 |
if (file == None):
|
415 |
result = generate_text(prompt, chatbot, history, rag_option, model_option, openai_api_key, k=3, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3,)
|
416 |
history = history + [(prompt, result)]
|
|
|
417 |
else:
|
418 |
#Es wurde ein Bild angehängt -> wenn prompt dazu, das Bild analysieren
|
419 |
#geht nur über spezielle OpenAI-Schnittstelle...
|
420 |
result= generate_text_zu_bild(file, prompt)
|
421 |
history = history + [((file,), None),(prompt, result)]
|
422 |
+
|
423 |
print("result..................")
|
424 |
print(result)
|
425 |
+
|
426 |
for character in result:
|
427 |
chatbot[-1][1] += character
|
428 |
time.sleep(0.03)
|
|
|
479 |
|
480 |
#Prompt an history anhängen und einen Text daraus machen
|
481 |
history_text_und_prompt = generate_prompt_with_history_openai(prompt, history)
|
482 |
+
|
|
|
483 |
#history für HuggingFace Models formatieren
|
484 |
#history_text_und_prompt = generate_prompt_with_history_hf(prompt, history)
|
485 |
#history für openAi formatieren
|