merterbak commited on
Commit
5abaf06
Β·
verified Β·
1 Parent(s): 72d849f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -21,11 +21,11 @@ model = AutoModel.from_pretrained(MODEL_NAME, _attn_implementation='flash_attent
21
  model = model.eval().cuda()
22
 
23
  MODEL_CONFIGS = {
24
- "⚑ Gundam": {"base_size": 1024, "image_size": 640, "crop_mode": True},
25
- "πŸš€ Tiny": {"base_size": 512, "image_size": 512, "crop_mode": False},
26
- "πŸ“„ Small": {"base_size": 640, "image_size": 640, "crop_mode": False},
27
- "πŸ“Š Base": {"base_size": 1024, "image_size": 1024, "crop_mode": False},
28
- "🎯 Large": {"base_size": 1280, "image_size": 1280, "crop_mode": False}
29
  }
30
 
31
  TASK_PROMPTS = {
@@ -230,7 +230,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek-OCR") as demo:
230
  with gr.Column(scale=1):
231
  file_in = gr.File(label="Upload Image or PDF", file_types=["image", ".pdf"], type="filepath")
232
  input_img = gr.Image(label="Input Image", type="pil", height=300)
233
- mode = gr.Dropdown(list(MODEL_CONFIGS.keys()), value="⚑ Gundam", label="Mode")
234
  task = gr.Dropdown(list(TASK_PROMPTS.keys()), value="πŸ“‹ Markdown", label="Task")
235
  prompt = gr.Textbox(label="Prompt", lines=2, visible=False)
236
  btn = gr.Button("Extract", variant="primary", size="lg")
@@ -250,8 +250,8 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek-OCR") as demo:
250
 
251
  gr.Examples(
252
  examples=[
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
@@ -269,7 +269,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek-OCR") as demo:
269
  ### Tasks
270
  - **Markdown**: Convert document to structured markdown (grounding βœ…)
271
  - **Free OCR**: Simple text extraction
272
- - **Locate**: Find specific text in image (grounding βœ…)
273
  - **Describe**: General image description
274
  - **Custom**: Your own prompt (add `<|grounding|>` for boxes)
275
  """)
 
21
  model = model.eval().cuda()
22
 
23
  MODEL_CONFIGS = {
24
+ "Gundam": {"base_size": 1024, "image_size": 640, "crop_mode": True},
25
+ "Tiny": {"base_size": 512, "image_size": 512, "crop_mode": False},
26
+ "Small": {"base_size": 640, "image_size": 640, "crop_mode": False},
27
+ "Base": {"base_size": 1024, "image_size": 1024, "crop_mode": False},
28
+ "Large": {"base_size": 1280, "image_size": 1280, "crop_mode": False}
29
  }
30
 
31
  TASK_PROMPTS = {
 
230
  with gr.Column(scale=1):
231
  file_in = gr.File(label="Upload Image or PDF", file_types=["image", ".pdf"], type="filepath")
232
  input_img = gr.Image(label="Input Image", type="pil", height=300)
233
+ mode = gr.Dropdown(list(MODEL_CONFIGS.keys()), value="Gundam", label="Mode")
234
  task = gr.Dropdown(list(TASK_PROMPTS.keys()), value="πŸ“‹ Markdown", label="Task")
235
  prompt = gr.Textbox(label="Prompt", lines=2, visible=False)
236
  btn = gr.Button("Extract", variant="primary", size="lg")
 
250
 
251
  gr.Examples(
252
  examples=[
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
 
269
  ### Tasks
270
  - **Markdown**: Convert document to structured markdown (grounding βœ…)
271
  - **Free OCR**: Simple text extraction
272
+ - **Locate**: Find specific things in image (grounding βœ…)
273
  - **Describe**: General image description
274
  - **Custom**: Your own prompt (add `<|grounding|>` for boxes)
275
  """)