Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def image_url_chat(image_url, text_query, temperature, top_p, max_output_tokens)
|
|
44 |
|
45 |
messages = [
|
46 |
{"role": "user", "content": [
|
47 |
-
{"type": "image_url", "image_url": {"url": image_url}},
|
48 |
{"type": "text", "text": text_query}
|
49 |
]},
|
50 |
]
|
@@ -71,7 +71,7 @@ def image_chat(image_file, text_query, temperature, top_p, max_output_tokens):
|
|
71 |
|
72 |
messages = [
|
73 |
{"role": "user", "content": [
|
74 |
-
{"type": "image_url", "image_url": {"url": image_data}},
|
75 |
{"type": "text", "text": text_query}
|
76 |
]},
|
77 |
]
|
@@ -149,7 +149,7 @@ with gr.Blocks() as demo:
|
|
149 |
with gr.Row():
|
150 |
temperature = gr.Slider(0, 2, value=1.0, step=0.1, label="Temperature")
|
151 |
top_p = gr.Slider(0, 1, value=1.0, step=0.1, label="Top-P")
|
152 |
-
max_output_tokens = gr.Slider(0, 16384, value=2048, step=512, label="Max Output Tokens")
|
153 |
|
154 |
with gr.Tabs():
|
155 |
with gr.Tab("Image URL Chat"):
|
@@ -182,7 +182,8 @@ with gr.Blocks() as demo:
|
|
182 |
audio_button = gr.Button("Ask", elem_id="ask_button")
|
183 |
|
184 |
with gr.Tab("Voice(Record) Chat"):
|
185 |
-
|
|
|
186 |
audio_record_query = gr.Textbox(label="Ask about the transcription")
|
187 |
audio_record_output = gr.Textbox(label="Response", interactive=False)
|
188 |
audio_record_button = gr.Button("Ask", elem_id="ask_button")
|
|
|
44 |
|
45 |
messages = [
|
46 |
{"role": "user", "content": [
|
47 |
+
{"type": "image_url", "image_url": {"url": image_url}},
|
48 |
{"type": "text", "text": text_query}
|
49 |
]},
|
50 |
]
|
|
|
71 |
|
72 |
messages = [
|
73 |
{"role": "user", "content": [
|
74 |
+
{"type": "image_url", "image_url": {"url": image_data}},
|
75 |
{"type": "text", "text": text_query}
|
76 |
]},
|
77 |
]
|
|
|
149 |
with gr.Row():
|
150 |
temperature = gr.Slider(0, 2, value=1.0, step=0.1, label="Temperature")
|
151 |
top_p = gr.Slider(0, 1, value=1.0, step=0.1, label="Top-P")
|
152 |
+
max_output_tokens = gr.Slider(0, 16384, value=2048, step=512, label="Max Output Tokens")
|
153 |
|
154 |
with gr.Tabs():
|
155 |
with gr.Tab("Image URL Chat"):
|
|
|
182 |
audio_button = gr.Button("Ask", elem_id="ask_button")
|
183 |
|
184 |
with gr.Tab("Voice(Record) Chat"):
|
185 |
+
# Fix: Changed parameter name to match your Gradio version
|
186 |
+
audio_record = gr.Audio(label="Record your voice", type="binary")
|
187 |
audio_record_query = gr.Textbox(label="Ask about the transcription")
|
188 |
audio_record_output = gr.Textbox(label="Response", interactive=False)
|
189 |
audio_record_button = gr.Button("Ask", elem_id="ask_button")
|