prithivMLmods commited on
Commit
d856f13
·
verified ·
1 Parent(s): ec872f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -117,6 +117,12 @@ moondream = AutoModelForCausalLM.from_pretrained(
117
  tokenizer_md = AutoTokenizer.from_pretrained(MODEL_ID_MD, revision=REVISION_MD)
118
 
119
 
 
 
 
 
 
 
120
  # --- PDF Generation and Preview Utility Function ---
121
  def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
122
  """
@@ -225,6 +231,7 @@ def process_document_stream(
225
  elif model_name == "VLAA-Thinker-Qwen2VL-2B(reason)": processor, model = processor_i, model_i
226
  elif model_name == "Nanonets-OCR-s(ocr)": processor, model = processor_a, model_a
227
  elif model_name == "Megalodon-OCR-Sync-0713(ocr)": processor, model = processor_x, model_x
 
228
  else:
229
  yield "Invalid model selected.", ""
230
  return
@@ -282,7 +289,7 @@ def create_gradio_interface():
282
  with gr.Column(scale=1):
283
  model_choice = gr.Dropdown(
284
  choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
285
- "VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "Nanonets-OCR-s(ocr)"],
286
  label="Select Model", value= "LFM2-VL-450M(fast)"
287
  )
288
  prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")
 
117
  tokenizer_md = AutoTokenizer.from_pretrained(MODEL_ID_MD, revision=REVISION_MD)
118
 
119
 
120
+ MODEL_ID_N = "MrLight/dse-qwen2-2b-mrl-v1"
121
+ processor_n = AutoProcessor.from_pretrained(MODEL_ID_N, trust_remote_code=True)
122
+ model_n = Qwen2VLForConditionalGeneration.from_pretrained(
123
+ MODEL_ID_N, trust_remote_code=True, torch_dtype=torch.float16
124
+ ).to(device).eval()
125
+
126
  # --- PDF Generation and Preview Utility Function ---
127
  def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
128
  """
 
231
  elif model_name == "VLAA-Thinker-Qwen2VL-2B(reason)": processor, model = processor_i, model_i
232
  elif model_name == "Nanonets-OCR-s(ocr)": processor, model = processor_a, model_a
233
  elif model_name == "Megalodon-OCR-Sync-0713(ocr)": processor, model = processor_x, model_x
234
+ elif model_name == "dse-qwen2-2b-mrl-v1(dse)": processor, model = processor_n, model_n
235
  else:
236
  yield "Invalid model selected.", ""
237
  return
 
289
  with gr.Column(scale=1):
290
  model_choice = gr.Dropdown(
291
  choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
292
+ "VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "dse-qwen2-2b-mrl-v1(dse)", "Nanonets-OCR-s(ocr)"],
293
  label="Select Model", value= "LFM2-VL-450M(fast)"
294
  )
295
  prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")