Update app.py
Browse files
app.py
CHANGED
|
@@ -60,9 +60,9 @@ with gr.Blocks(title="Qwen2.5-VL-7B via Inference API") as demo:
|
|
| 60 |
show_copy_button=True
|
| 61 |
)
|
| 62 |
|
| 63 |
-
|
| 64 |
file_input.change(
|
| 65 |
-
fn=lambda files: [f
|
| 66 |
inputs=file_input,
|
| 67 |
outputs=gallery
|
| 68 |
)
|
|
@@ -73,4 +73,4 @@ with gr.Blocks(title="Qwen2.5-VL-7B via Inference API") as demo:
|
|
| 73 |
# Clear all fields
|
| 74 |
clear_btn.click(lambda: ([], 128, [], ""), outputs=[file_input, max_new_tokens, gallery, output])
|
| 75 |
|
| 76 |
-
demo.launch()()
|
|
|
|
| 60 |
show_copy_button=True
|
| 61 |
)
|
| 62 |
|
| 63 |
+
# Show image previews in the gallery when images are selected
|
| 64 |
file_input.change(
|
| 65 |
+
fn=lambda files: [Image.open(f.name).convert("RGB") for f in (files or [])],
|
| 66 |
inputs=file_input,
|
| 67 |
outputs=gallery
|
| 68 |
)
|
|
|
|
| 73 |
# Clear all fields
|
| 74 |
clear_btn.click(lambda: ([], 128, [], ""), outputs=[file_input, max_new_tokens, gallery, output])
|
| 75 |
|
| 76 |
+
demo.launch()()()
|