merterbak commited on
Commit
a38cbe7
Β·
verified Β·
1 Parent(s): d887ae4

example thumbnail fix

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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=[file_in, mode, task, prompt],
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
- btn.click(process_file, [file_in, mode, task, prompt], [text_out, md_out, raw_out, img_out, gallery])
 
 
 
 
 
 
 
 
 
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()