prithivMLmods commited on
Commit
09a1add
·
verified ·
1 Parent(s): 7f1e816

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -123,6 +123,13 @@ model_n = Qwen2_5_VLForConditionalGeneration.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
  """
@@ -232,6 +239,7 @@ def process_document_stream(
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 == "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)": processor, model = processor_n, model_n
 
235
  else:
236
  yield "Invalid model selected.", ""
237
  return
@@ -289,7 +297,8 @@ def create_gradio_interface():
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)", "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)", "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!")
 
123
  MODEL_ID_N, trust_remote_code=True, torch_dtype=torch.float16
124
  ).to(device).eval()
125
 
126
+ # --- LMM-R1-MGT-PerceReason ---
127
+ MODEL_ID_F = "VLM-Reasoner/LMM-R1-MGT-PerceReason"
128
+ processor_f = AutoProcessor.from_pretrained(MODEL_ID_F, trust_remote_code=True)
129
+ model_f = Qwen2_5_VLForConditionalGeneration.from_pretrained(
130
+ MODEL_ID_F, trust_remote_code=True, torch_dtype=torch.float16
131
+ ).to(device).eval()
132
+
133
  # --- PDF Generation and Preview Utility Function ---
134
  def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
135
  """
 
239
  elif model_name == "Nanonets-OCR-s(ocr)": processor, model = processor_a, model_a
240
  elif model_name == "Megalodon-OCR-Sync-0713(ocr)": processor, model = processor_x, model_x
241
  elif model_name == "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)": processor, model = processor_n, model_n
242
+ elif model_name == "LMM-R1-MGT-PerceReason(reason)": processor, model = processor_f, model_f
243
  else:
244
  yield "Invalid model selected.", ""
245
  return
 
297
  with gr.Column(scale=1):
298
  model_choice = gr.Dropdown(
299
  choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
300
+ "VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)", "Nanonets-OCR-s(ocr)",
301
+ "LMM-R1-MGT-PerceReason(reason)"],
302
  label="Select Model", value= "LFM2-VL-450M(fast)"
303
  )
304
  prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")