Spaces:
Runtime error
Runtime error
upload
Browse files
app.py
CHANGED
|
@@ -19,9 +19,7 @@ model.to("cuda:0")
|
|
| 19 |
|
| 20 |
PLACEHOLDER = """
|
| 21 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
| 22 |
-
<
|
| 23 |
-
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Microsoft's Phi3 Vision</h1>
|
| 24 |
-
<p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Phi-3-Vision is a 4.2B parameter multimodal model that brings together language and vision capabilities.</p>
|
| 25 |
</div>
|
| 26 |
"""
|
| 27 |
|
|
@@ -44,10 +42,10 @@ def bot_streaming(message, history):
|
|
| 44 |
try:
|
| 45 |
if image is None:
|
| 46 |
# Handle the case where image is None
|
| 47 |
-
raise gr.Error("You need to upload an image for
|
| 48 |
except NameError:
|
| 49 |
# Handle the case where 'image' is not defined at all
|
| 50 |
-
raise gr.Error("You need to upload an image for
|
| 51 |
|
| 52 |
conversation = []
|
| 53 |
flag=False
|
|
@@ -90,14 +88,14 @@ chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image"], placeh
|
|
| 90 |
with gr.Blocks(fill_height=True, ) as demo:
|
| 91 |
gr.ChatInterface(
|
| 92 |
fn=bot_streaming,
|
| 93 |
-
title="
|
| 94 |
examples=[{"text": "Describe the image in details?", "files": ["./robo.jpg"]},
|
| 95 |
{"text": "What does the chart display?", "files": ["./dataviz.png"]},
|
| 96 |
{"text": "What is 3?", "files": ["./setofmark1.jpg"]},
|
| 97 |
{"text": "Count the number of apples.", "files": ["./setofmark6.png"]},
|
| 98 |
{"text": "I want to find a seat close to windows, where can I sit?", "files": ["./office1.jpg"]},
|
| 99 |
],
|
| 100 |
-
description="
|
| 101 |
stop_btn="Stop Generation",
|
| 102 |
multimodal=True,
|
| 103 |
textbox=chat_input,
|
|
|
|
| 19 |
|
| 20 |
PLACEHOLDER = """
|
| 21 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
| 22 |
+
<p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">DifferentByte vision model</p>
|
|
|
|
|
|
|
| 23 |
</div>
|
| 24 |
"""
|
| 25 |
|
|
|
|
| 42 |
try:
|
| 43 |
if image is None:
|
| 44 |
# Handle the case where image is None
|
| 45 |
+
raise gr.Error("You need to upload an image for DifferentByte Vision to work. Close the error and try again with an Image.")
|
| 46 |
except NameError:
|
| 47 |
# Handle the case where 'image' is not defined at all
|
| 48 |
+
raise gr.Error("You need to upload an image for Vision to work. Close the error and try again with an Image.")
|
| 49 |
|
| 50 |
conversation = []
|
| 51 |
flag=False
|
|
|
|
| 88 |
with gr.Blocks(fill_height=True, ) as demo:
|
| 89 |
gr.ChatInterface(
|
| 90 |
fn=bot_streaming,
|
| 91 |
+
title="DifferentByt",
|
| 92 |
examples=[{"text": "Describe the image in details?", "files": ["./robo.jpg"]},
|
| 93 |
{"text": "What does the chart display?", "files": ["./dataviz.png"]},
|
| 94 |
{"text": "What is 3?", "files": ["./setofmark1.jpg"]},
|
| 95 |
{"text": "Count the number of apples.", "files": ["./setofmark6.png"]},
|
| 96 |
{"text": "I want to find a seat close to windows, where can I sit?", "files": ["./office1.jpg"]},
|
| 97 |
],
|
| 98 |
+
description="Upload an image and start chatting.This is not the official demo.",
|
| 99 |
stop_btn="Stop Generation",
|
| 100 |
multimodal=True,
|
| 101 |
textbox=chat_input,
|