Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ from transformers import (
|
|
22 |
Qwen2_5_VLForConditionalGeneration,
|
23 |
AutoModelForVision2Seq,
|
24 |
AutoModelForImageTextToText,
|
|
|
25 |
AutoProcessor,
|
26 |
TextIteratorStreamer,
|
27 |
)
|
@@ -76,9 +77,9 @@ model_g = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
76 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.float16
|
77 |
).to(device).eval()
|
78 |
|
79 |
-
MODEL_ID_I = "
|
80 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
81 |
-
model_i =
|
82 |
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
83 |
).to(device).eval()
|
84 |
|
@@ -177,7 +178,7 @@ def process_document_stream(
|
|
177 |
elif model_name == "LFM2-VL-1.6B": processor, model = processor_t, model_t
|
178 |
elif model_name == "SmolVLM-Instruct-250M": processor, model = processor_c, model_c
|
179 |
elif model_name == "MonkeyOCR-Recognition": processor, model = processor_g, model_g
|
180 |
-
elif model_name == "
|
181 |
else:
|
182 |
yield "Invalid model selected.", ""
|
183 |
return
|
@@ -234,7 +235,7 @@ def create_gradio_interface():
|
|
234 |
# Left Column (Inputs)
|
235 |
with gr.Column(scale=1):
|
236 |
model_choice = gr.Dropdown(
|
237 |
-
choices=["LFM2-VL-1.6B", "LFM2-VL-450M", "SmolVLM-Instruct-250M", "
|
238 |
label="Select Model", value="LFM2-VL-1.6B"
|
239 |
)
|
240 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query")
|
|
|
22 |
Qwen2_5_VLForConditionalGeneration,
|
23 |
AutoModelForVision2Seq,
|
24 |
AutoModelForImageTextToText,
|
25 |
+
AutoModel,
|
26 |
AutoProcessor,
|
27 |
TextIteratorStreamer,
|
28 |
)
|
|
|
77 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.float16
|
78 |
).to(device).eval()
|
79 |
|
80 |
+
MODEL_ID_I = "5CD-AI/Vintern-1B-v3_5"
|
81 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
82 |
+
model_i = AutoModel.from_pretrained(
|
83 |
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
84 |
).to(device).eval()
|
85 |
|
|
|
178 |
elif model_name == "LFM2-VL-1.6B": processor, model = processor_t, model_t
|
179 |
elif model_name == "SmolVLM-Instruct-250M": processor, model = processor_c, model_c
|
180 |
elif model_name == "MonkeyOCR-Recognition": processor, model = processor_g, model_g
|
181 |
+
elif model_name == "Vintern-1B-v3_5": processor, model = processor_i, model_i
|
182 |
else:
|
183 |
yield "Invalid model selected.", ""
|
184 |
return
|
|
|
235 |
# Left Column (Inputs)
|
236 |
with gr.Column(scale=1):
|
237 |
model_choice = gr.Dropdown(
|
238 |
+
choices=["LFM2-VL-1.6B", "LFM2-VL-450M", "SmolVLM-Instruct-250M", "Vintern-1B-v3_5", "Megalodon-OCR-Sync-0713"],
|
239 |
label="Select Model", value="LFM2-VL-1.6B"
|
240 |
)
|
241 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query")
|