Update app.py
Browse files
app.py
CHANGED
|
@@ -368,6 +368,10 @@ def vote(data: gr.LikeData):
|
|
| 368 |
if data.liked: print("You upvoted this response: " + data.value)
|
| 369 |
else: print("You downvoted this response: " + data.value)
|
| 370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
additional_inputs = [
|
| 372 |
#gr.Radio(["Off", "Chroma", "MongoDB"], label="Retrieval Augmented Generation", value = "Off"),
|
| 373 |
gr.Radio(["Aus", "An"], label="RAG - LI Erweiterungen", value = "Aus"),
|
|
@@ -392,7 +396,24 @@ chat_interface_stream = gr.ChatInterface(fn=invoke,
|
|
| 392 |
submit_btn = "Abschicken",
|
| 393 |
description = description)
|
| 394 |
|
|
|
|
|
|
|
| 395 |
with gr.Blocks() as demo:
|
| 396 |
with gr.Tab("Chatbot"):
|
| 397 |
-
|
| 398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
if data.liked: print("You upvoted this response: " + data.value)
|
| 369 |
else: print("You downvoted this response: " + data.value)
|
| 370 |
|
| 371 |
+
def read_image(image, size=512):
|
| 372 |
+
return np.array(Image.fromarray(image).resize((size, size)))
|
| 373 |
+
|
| 374 |
+
|
| 375 |
additional_inputs = [
|
| 376 |
#gr.Radio(["Off", "Chroma", "MongoDB"], label="Retrieval Augmented Generation", value = "Off"),
|
| 377 |
gr.Radio(["Aus", "An"], label="RAG - LI Erweiterungen", value = "Aus"),
|
|
|
|
| 396 |
submit_btn = "Abschicken",
|
| 397 |
description = description)
|
| 398 |
|
| 399 |
+
reference_image = gr.Image(label="Reference Image")
|
| 400 |
+
|
| 401 |
with gr.Blocks() as demo:
|
| 402 |
with gr.Tab("Chatbot"):
|
| 403 |
+
with gr.Row():
|
| 404 |
+
chatbot_stream.like(vote, None, None)
|
| 405 |
+
chat_interface_stream #.queue().launch()
|
| 406 |
+
with gr.Row():
|
| 407 |
+
reference_image
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
# when `first_frame` is updated
|
| 411 |
+
reference_image.upload(
|
| 412 |
+
read_image,
|
| 413 |
+
reference_image,
|
| 414 |
+
reference_image,
|
| 415 |
+
queue=False
|
| 416 |
+
)
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
demo..queue().launch()
|