Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -287,6 +287,18 @@ def generate_prompt_with_history_langchain(prompt, history):
|
|
| 287 |
|
| 288 |
###################################################
|
| 289 |
#Funktion von Gradio aus, die den dort eingegebenen Prompt annimmt und weiterverarbeitet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
def invoke (prompt, history, rag_option, model_option, openai_api_key, temperature=0.5, max_new_tokens=4048, top_p=0.6, repetition_penalty=1.3,):
|
| 291 |
global splittet
|
| 292 |
print(splittet)
|
|
@@ -417,7 +429,7 @@ with gr.Blocks() as demo:
|
|
| 417 |
""")
|
| 418 |
with gr.Tab("Chatbot"):
|
| 419 |
iface = gr.Interface(
|
| 420 |
-
fn=
|
| 421 |
inputs=[reference_image, chat_interface_stream],
|
| 422 |
outputs=chat_interface_stream,
|
| 423 |
title="Chatbot mit Bildeingabe",
|
|
|
|
| 287 |
|
| 288 |
###################################################
|
| 289 |
#Funktion von Gradio aus, die den dort eingegebenen Prompt annimmt und weiterverarbeitet
|
| 290 |
+
#erstmal gucken, ob text oder Bild angekommen ist
|
| 291 |
+
def chatbot_response(messages, history, rag_option, model_option, openai_api_key, temperature=0.5, max_new_tokens=4048, top_p=0.6, repetition_penalty=1.3,):
|
| 292 |
+
responses = []
|
| 293 |
+
for message in messages:
|
| 294 |
+
if message['type'] == 'text':
|
| 295 |
+
invoke(message['data'], history, rag_option, model_option, openai_api_key, temperature=0.5, max_new_tokens=4048, top_p=0.6, repetition_penalty=1.3,)
|
| 296 |
+
responses.append({'type': 'text', 'data': f"Echo: {message['data']}"})
|
| 297 |
+
else:
|
| 298 |
+
print("Bild.............................")
|
| 299 |
+
return responses
|
| 300 |
+
|
| 301 |
+
|
| 302 |
def invoke (prompt, history, rag_option, model_option, openai_api_key, temperature=0.5, max_new_tokens=4048, top_p=0.6, repetition_penalty=1.3,):
|
| 303 |
global splittet
|
| 304 |
print(splittet)
|
|
|
|
| 429 |
""")
|
| 430 |
with gr.Tab("Chatbot"):
|
| 431 |
iface = gr.Interface(
|
| 432 |
+
fn=chatbot_response,
|
| 433 |
inputs=[reference_image, chat_interface_stream],
|
| 434 |
outputs=chat_interface_stream,
|
| 435 |
title="Chatbot mit Bildeingabe",
|