prithivMLmods commited on
Commit
35725e4
·
verified ·
1 Parent(s): e9dab78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -60,13 +60,12 @@ model_z = Qwen2_5_VLForConditionalGeneration.from_pretrained(
60
  torch_dtype=torch.float16
61
  ).to(device).eval()
62
 
63
- # Load moondream
64
- MODEL_ID_T = "moondream/moondream-2b-2025-04-14-4bit"
65
  processor_t = AutoTokenizer.from_pretrained(MODEL_ID_X, trust_remote_code=True)
66
- model_t = AutoModelForCausalLM.from_pretrained(
67
  MODEL_ID_T,
68
  trust_remote_code=True,
69
- attn_implementation="flash_attention_2",
70
  torch_dtype=torch.float16
71
  ).to(device).eval()
72
 
@@ -112,7 +111,7 @@ def generate_image(model_name: str, text: str, image: Image.Image,
112
  elif model_name == "SpaceThinker-Qwen2.5VL-3B":
113
  processor = processor_z
114
  model = model_z
115
- elif model_name == "moondream-2b-2025-04-14-4bit":
116
  processor = processor_t
117
  model = model_t
118
  else:
@@ -168,7 +167,7 @@ def generate_video(model_name: str, text: str, video_path: str,
168
  elif model_name == "SpaceThinker-Qwen2.5VL-3B":
169
  processor = processor_z
170
  model = model_z
171
- elif model_name == "moondream-2b-2025-04-14-4bit":
172
  processor = processor_t
173
  model = model_t
174
  else:
@@ -268,9 +267,9 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
268
  with gr.Column():
269
  output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
270
  model_choice = gr.Radio(
271
- choices=["coreOCR-7B-050325-preview", "typhoon-ocr-7b", "SpaceThinker-Qwen2.5VL-3B", "moondream-2b-2025-04-14-4bit"],
272
  label="Select Model",
273
- value="coreOCR-7B-050325-preview"
274
  )
275
 
276
  image_submit.click(
 
60
  torch_dtype=torch.float16
61
  ).to(device).eval()
62
 
63
+ # Load Qwen2-VL-7B-Instruct
64
+ MODEL_ID_T = "Qwen/Qwen2-VL-7B-Instruct"
65
  processor_t = AutoTokenizer.from_pretrained(MODEL_ID_X, trust_remote_code=True)
66
+ model_t = Qwen2VLForConditionalGeneration.from_pretrained(
67
  MODEL_ID_T,
68
  trust_remote_code=True,
 
69
  torch_dtype=torch.float16
70
  ).to(device).eval()
71
 
 
111
  elif model_name == "SpaceThinker-Qwen2.5VL-3B":
112
  processor = processor_z
113
  model = model_z
114
+ elif model_name == "Qwen2-VL-7B-Instruct":
115
  processor = processor_t
116
  model = model_t
117
  else:
 
167
  elif model_name == "SpaceThinker-Qwen2.5VL-3B":
168
  processor = processor_z
169
  model = model_z
170
+ elif model_name == "Qwen2-VL-7B-Instruct":
171
  processor = processor_t
172
  model = model_t
173
  else:
 
267
  with gr.Column():
268
  output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
269
  model_choice = gr.Radio(
270
+ choices=["coreOCR-7B-050325-preview", "Qwen2-VL-7B-Instruct", "SpaceThinker-Qwen2.5VL-3B", "typhoon-ocr-7b"],
271
  label="Select Model",
272
+ value="Qwen2-VL-7B-Instruct"
273
  )
274
 
275
  image_submit.click(