prithivMLmods commited on
Commit
30151c4
·
verified ·
1 Parent(s): 7abceaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -96,8 +96,8 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
96
 
97
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
98
 
99
- # Load Nanonets-OCR-s
100
- MODEL_ID_M = "nanonets/Nanonets-OCR-s"
101
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
102
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
103
  MODEL_ID_M,
@@ -125,7 +125,7 @@ def generate_image(model_name: str, text: str, image: Image.Image,
125
  top_k: int = 50,
126
  repetition_penalty: float = 1.2):
127
  """Generate responses for image input using the selected model."""
128
- if model_name == "Nanonets-OCR-s":
129
  processor, model = processor_m, model_m
130
  elif model_name == "Dots.OCR":
131
  processor, model = processor_d, model_d
@@ -197,9 +197,9 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
197
  formatted_output = gr.Markdown(label="Formatted Result")
198
 
199
  model_choice = gr.Radio(
200
- choices=["Nanonets-OCR-s", "Dots.OCR"],
201
  label="Select Model",
202
- value="Nanonets-OCR-s"
203
  )
204
 
205
  image_submit.click(
 
96
 
97
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
98
 
99
+ # Load Nanonets-OCR2-3B
100
+ MODEL_ID_M = "nanonets/Nanonets-OCR2-3B"
101
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
102
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
103
  MODEL_ID_M,
 
125
  top_k: int = 50,
126
  repetition_penalty: float = 1.2):
127
  """Generate responses for image input using the selected model."""
128
+ if model_name == "Nanonets-OCR2-3B":
129
  processor, model = processor_m, model_m
130
  elif model_name == "Dots.OCR":
131
  processor, model = processor_d, model_d
 
197
  formatted_output = gr.Markdown(label="Formatted Result")
198
 
199
  model_choice = gr.Radio(
200
+ choices=["Nanonets-OCR2-3B", "Dots.OCR"],
201
  label="Select Model",
202
+ value="Nanonets-OCR2-3B"
203
  )
204
 
205
  image_submit.click(