prithivMLmods commited on
Commit
b1eb6b5
·
verified ·
1 Parent(s): d779502

update app

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -101,6 +101,7 @@ MODEL_ID_N = "prithivMLmods/DeepCaption-VLA-7B"
101
  processor_n = AutoProcessor.from_pretrained(MODEL_ID_N, trust_remote_code=True)
102
  model_n = Qwen2_5_VLForConditionalGeneration.from_pretrained(
103
  MODEL_ID_N,
 
104
  trust_remote_code=True,
105
  torch_dtype=torch.float16
106
  ).to(device).eval()
@@ -110,6 +111,7 @@ MODEL_ID_M = "Skywork/SkyCaptioner-V1"
110
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
111
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
112
  MODEL_ID_M,
 
113
  trust_remote_code=True,
114
  torch_dtype=torch.float16
115
  ).to(device).eval()
@@ -119,6 +121,7 @@ MODEL_ID_Z = "remyxai/SpaceThinker-Qwen2.5VL-3B"
119
  processor_z = AutoProcessor.from_pretrained(MODEL_ID_Z, trust_remote_code=True)
120
  model_z = Qwen2_5_VLForConditionalGeneration.from_pretrained(
121
  MODEL_ID_Z,
 
122
  trust_remote_code=True,
123
  torch_dtype=torch.float16
124
  ).to(device).eval()
@@ -128,6 +131,7 @@ MODEL_ID_K = "prithivMLmods/coreOCR-7B-050325-preview"
128
  processor_k = AutoProcessor.from_pretrained(MODEL_ID_K, trust_remote_code=True)
129
  model_k = Qwen2VLForConditionalGeneration.from_pretrained(
130
  MODEL_ID_K,
 
131
  trust_remote_code=True,
132
  torch_dtype=torch.float16
133
  ).to(device).eval()
@@ -137,6 +141,7 @@ MODEL_ID_Y = "remyxai/SpaceOm"
137
  processor_y = AutoProcessor.from_pretrained(MODEL_ID_Y, trust_remote_code=True)
138
  model_y = Qwen2_5_VLForConditionalGeneration.from_pretrained(
139
  MODEL_ID_Y,
 
140
  trust_remote_code=True,
141
  torch_dtype=torch.float16
142
  ).to(device).eval()
@@ -310,7 +315,7 @@ css = """
310
  """
311
 
312
  # Create the Gradio Interface
313
- with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
314
  gr.Markdown("# **VisionScope R2**", elem_id="main-title")
315
  with gr.Row():
316
  with gr.Column(scale=2):
@@ -333,7 +338,7 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
333
  repetition_penalty = gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2)
334
  with gr.Column(scale=3):
335
  gr.Markdown("## Output", elem_id="output-title")
336
- output = gr.Textbox(label="Raw Output Stream", interactive=False, lines=11, show_copy_button=True)
337
  with gr.Accordion("(Result.md)", open=False):
338
  markdown_output = gr.Markdown(label="Formatted Result")
339
  model_choice = gr.Radio(
@@ -353,4 +358,4 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
353
  )
354
 
355
  if __name__ == "__main__":
356
- demo.queue(max_size=50).launch(mcp_server=True, ssr_mode=False, show_error=True)
 
101
  processor_n = AutoProcessor.from_pretrained(MODEL_ID_N, trust_remote_code=True)
102
  model_n = Qwen2_5_VLForConditionalGeneration.from_pretrained(
103
  MODEL_ID_N,
104
+ attn_implementation="flash_attention_2",
105
  trust_remote_code=True,
106
  torch_dtype=torch.float16
107
  ).to(device).eval()
 
111
  processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
112
  model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
113
  MODEL_ID_M,
114
+ attn_implementation="flash_attention_2",
115
  trust_remote_code=True,
116
  torch_dtype=torch.float16
117
  ).to(device).eval()
 
121
  processor_z = AutoProcessor.from_pretrained(MODEL_ID_Z, trust_remote_code=True)
122
  model_z = Qwen2_5_VLForConditionalGeneration.from_pretrained(
123
  MODEL_ID_Z,
124
+ attn_implementation="flash_attention_2",
125
  trust_remote_code=True,
126
  torch_dtype=torch.float16
127
  ).to(device).eval()
 
131
  processor_k = AutoProcessor.from_pretrained(MODEL_ID_K, trust_remote_code=True)
132
  model_k = Qwen2VLForConditionalGeneration.from_pretrained(
133
  MODEL_ID_K,
134
+ attn_implementation="flash_attention_2",
135
  trust_remote_code=True,
136
  torch_dtype=torch.float16
137
  ).to(device).eval()
 
141
  processor_y = AutoProcessor.from_pretrained(MODEL_ID_Y, trust_remote_code=True)
142
  model_y = Qwen2_5_VLForConditionalGeneration.from_pretrained(
143
  MODEL_ID_Y,
144
+ attn_implementation="flash_attention_2",
145
  trust_remote_code=True,
146
  torch_dtype=torch.float16
147
  ).to(device).eval()
 
315
  """
316
 
317
  # Create the Gradio Interface
318
+ with gr.Blocks() as demo:
319
  gr.Markdown("# **VisionScope R2**", elem_id="main-title")
320
  with gr.Row():
321
  with gr.Column(scale=2):
 
338
  repetition_penalty = gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2)
339
  with gr.Column(scale=3):
340
  gr.Markdown("## Output", elem_id="output-title")
341
+ output = gr.Textbox(label="Raw Output Stream", interactive=True, lines=11)
342
  with gr.Accordion("(Result.md)", open=False):
343
  markdown_output = gr.Markdown(label="Formatted Result")
344
  model_choice = gr.Radio(
 
358
  )
359
 
360
  if __name__ == "__main__":
361
+ demo.queue(max_size=50).launch(css=css, theme=steel_blue_theme, mcp_server=True, ssr_mode=False, show_error=True)