Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,6 @@ def qwen_inference(media_input, text_input=None):
|
|
115 |
buffer += new_text
|
116 |
yield buffer
|
117 |
|
118 |
-
|
119 |
css = """
|
120 |
#output {
|
121 |
height: 500px;
|
@@ -131,28 +130,15 @@ with gr.Blocks(css=css) as demo:
|
|
131 |
with gr.Row():
|
132 |
with gr.Column():
|
133 |
input_media = gr.File(
|
134 |
-
label="Upload Image or Video", type="filepath"
|
135 |
)
|
136 |
-
image_viewer = gr.Image(label="Uploaded Image", interactive=False, visible=False)
|
137 |
text_input = gr.Textbox(label="Question")
|
138 |
submit_btn = gr.Button(value="Submit")
|
139 |
with gr.Column():
|
140 |
output_text = gr.Textbox(label="Output Text")
|
141 |
|
142 |
-
# Display the uploaded image
|
143 |
-
def display_uploaded_image(media_input):
|
144 |
-
if media_input.endswith(tuple([i for i, f in image_extensions.items()])):
|
145 |
-
return media_input, True # Show image
|
146 |
-
return None, False # Hide image
|
147 |
-
|
148 |
-
input_media.change(
|
149 |
-
display_uploaded_image,
|
150 |
-
inputs=input_media,
|
151 |
-
outputs=[image_viewer, image_viewer.visible]
|
152 |
-
)
|
153 |
-
|
154 |
submit_btn.click(
|
155 |
qwen_inference, [input_media, text_input], [output_text]
|
156 |
)
|
157 |
|
158 |
-
demo.launch(debug=True)
|
|
|
115 |
buffer += new_text
|
116 |
yield buffer
|
117 |
|
|
|
118 |
css = """
|
119 |
#output {
|
120 |
height: 500px;
|
|
|
130 |
with gr.Row():
|
131 |
with gr.Column():
|
132 |
input_media = gr.File(
|
133 |
+
label="Upload Image or Video", type="filepath"
|
134 |
)
|
|
|
135 |
text_input = gr.Textbox(label="Question")
|
136 |
submit_btn = gr.Button(value="Submit")
|
137 |
with gr.Column():
|
138 |
output_text = gr.Textbox(label="Output Text")
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
submit_btn.click(
|
141 |
qwen_inference, [input_media, text_input], [output_text]
|
142 |
)
|
143 |
|
144 |
+
demo.launch(debug=True)
|