Spaces:
Paused
Paused
Updated app.py
Browse files
app.py
CHANGED
|
@@ -455,14 +455,14 @@ def transform_history(history):
|
|
| 455 |
def upload_to_gemini(path, mime_type=None):
|
| 456 |
file = genai.upload_file(path, mime_type=mime_type)
|
| 457 |
print(f"Uploaded file '{file.display_name}' as: {file.uri}")
|
| 458 |
-
return file
|
| 459 |
|
| 460 |
|
| 461 |
def chatbot_nightly(message, history):
|
| 462 |
print(type(message))
|
| 463 |
print(message)
|
| 464 |
message_text = message["text"]
|
| 465 |
-
message_files = message["files"]
|
| 466 |
if message_files and isinstance(message_files, list):
|
| 467 |
image_uris = [upload_to_gemini(file_path) for file_path in message_files]
|
| 468 |
message_content = [{"text": message_text}] + image_uris
|
|
@@ -565,11 +565,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 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 ==============================
|
|
|
|
| 455 |
def upload_to_gemini(path, mime_type=None):
|
| 456 |
file = genai.upload_file(path, mime_type=mime_type)
|
| 457 |
print(f"Uploaded file '{file.display_name}' as: {file.uri}")
|
| 458 |
+
return file
|
| 459 |
|
| 460 |
|
| 461 |
def chatbot_nightly(message, history):
|
| 462 |
print(type(message))
|
| 463 |
print(message)
|
| 464 |
message_text = message["text"]
|
| 465 |
+
message_files = message["files"]
|
| 466 |
if message_files and isinstance(message_files, list):
|
| 467 |
image_uris = [upload_to_gemini(file_path) for file_path in message_files]
|
| 468 |
message_content = [{"text": message_text}] + image_uris
|
|
|
|
| 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 |
title='Chat with Gemini 1.5',
|
|
|
|
|
|
|
|
|
|
| 569 |
multimodal=True
|
| 570 |
)
|
| 571 |
# ============================== Nightly - END ==============================
|