Spaces:
Paused
Paused
Updated app.py
Browse files
app.py
CHANGED
|
@@ -458,7 +458,7 @@ def upload_to_gemini(path, mime_type=None):
|
|
| 458 |
return file.uri
|
| 459 |
|
| 460 |
|
| 461 |
-
def
|
| 462 |
print(type(message))
|
| 463 |
print(message)
|
| 464 |
message_text = message["text"]
|
|
@@ -501,12 +501,12 @@ def response(message, history):
|
|
| 501 |
global chat
|
| 502 |
chat = model_nightly.start_chat(history=[])
|
| 503 |
chat.history = transform_history(history)
|
| 504 |
-
|
| 505 |
-
|
| 506 |
|
| 507 |
-
for i in range(len(
|
| 508 |
time.sleep(0.05)
|
| 509 |
-
yield
|
| 510 |
|
| 511 |
|
| 512 |
# ============================== Nightly - END ==============================
|
|
@@ -564,13 +564,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 564 |
with gr.Tab("Nightly -- Chat with Gemini 1.5"):
|
| 565 |
gr.HTML("""<h1 align="center">This section will test out the next version of the stable version.</h1>""")
|
| 566 |
gr.ChatInterface(
|
| 567 |
-
|
| 568 |
-
chatbot=gr.Chatbot(height=
|
| 569 |
title='Chat with Gemini 1.5',
|
| 570 |
-
retry_btn="Retry",
|
| 571 |
-
undo_btn="Undo",
|
| 572 |
-
clear_btn="Clear",
|
| 573 |
-
fill_height=True,
|
| 574 |
multimodal=True
|
| 575 |
)
|
| 576 |
# ============================== Nightly - END ==============================
|
|
|
|
| 458 |
return file.uri
|
| 459 |
|
| 460 |
|
| 461 |
+
def chatbot_nightly(message, history):
|
| 462 |
print(type(message))
|
| 463 |
print(message)
|
| 464 |
message_text = message["text"]
|
|
|
|
| 501 |
global chat
|
| 502 |
chat = model_nightly.start_chat(history=[])
|
| 503 |
chat.history = transform_history(history)
|
| 504 |
+
response_nightly = chat.send_message(message_content)
|
| 505 |
+
response_nightly.resolve()
|
| 506 |
|
| 507 |
+
for i in range(len(response_nightly.text)):
|
| 508 |
time.sleep(0.05)
|
| 509 |
+
yield response_nightly.text[:i + 1]
|
| 510 |
|
| 511 |
|
| 512 |
# ============================== Nightly - END ==============================
|
|
|
|
| 564 |
with gr.Tab("Nightly -- Chat with Gemini 1.5"):
|
| 565 |
gr.HTML("""<h1 align="center">This section will test out the next version of the stable version.</h1>""")
|
| 566 |
gr.ChatInterface(
|
| 567 |
+
chatbot_nightly,
|
| 568 |
+
# chatbot=gr.Chatbot(height=500),
|
| 569 |
title='Chat with Gemini 1.5',
|
| 570 |
+
# retry_btn="Retry",
|
| 571 |
+
# undo_btn="Undo",
|
| 572 |
+
# clear_btn="Clear",
|
|
|
|
| 573 |
multimodal=True
|
| 574 |
)
|
| 575 |
# ============================== Nightly - END ==============================
|