Spaces:
Running
on
Zero
Running
on
Zero
example thumbnail fix
Browse files
app.py
CHANGED
|
@@ -253,7 +253,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek-OCR") as demo:
|
|
| 253 |
["examples/ocr.jpg", "β‘ Gundam", "π Markdown", ""],
|
| 254 |
["examples/reachy-mini.jpg", "β‘ Gundam", "π Locate", "Robot"]
|
| 255 |
],
|
| 256 |
-
inputs=[
|
| 257 |
cache_examples=False
|
| 258 |
)
|
| 259 |
|
|
@@ -276,7 +276,16 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek-OCR") as demo:
|
|
| 276 |
|
| 277 |
file_in.change(load_image, [file_in], [input_img])
|
| 278 |
task.change(toggle_prompt, [task], [prompt])
|
| 279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
if __name__ == "__main__":
|
| 282 |
demo.queue(max_size=20).launch()
|
|
|
|
| 253 |
["examples/ocr.jpg", "β‘ Gundam", "π Markdown", ""],
|
| 254 |
["examples/reachy-mini.jpg", "β‘ Gundam", "π Locate", "Robot"]
|
| 255 |
],
|
| 256 |
+
inputs=[input_img, mode, task, prompt],
|
| 257 |
cache_examples=False
|
| 258 |
)
|
| 259 |
|
|
|
|
| 276 |
|
| 277 |
file_in.change(load_image, [file_in], [input_img])
|
| 278 |
task.change(toggle_prompt, [task], [prompt])
|
| 279 |
+
|
| 280 |
+
def run(image, file_path, mode, task, custom_prompt):
|
| 281 |
+
if image is not None:
|
| 282 |
+
return process_image(image, mode, task, custom_prompt)
|
| 283 |
+
if file_path:
|
| 284 |
+
return process_file(file_path, mode, task, custom_prompt)
|
| 285 |
+
return "Error uploading file or image", "", "", None, []
|
| 286 |
+
|
| 287 |
+
btn.click(run, [input_img, file_in, mode, task, prompt],
|
| 288 |
+
[text_out, md_out, raw_out, img_out, gallery])
|
| 289 |
|
| 290 |
if __name__ == "__main__":
|
| 291 |
demo.queue(max_size=20).launch()
|