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 |
AutoModel,
|
26 |
AutoProcessor,
|
27 |
TextIteratorStreamer,
|
@@ -77,9 +78,9 @@ model_g = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
77 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.float16
|
78 |
).to(device).eval()
|
79 |
|
80 |
-
MODEL_ID_I = "
|
81 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
82 |
-
model_i =
|
83 |
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
84 |
).to(device).eval()
|
85 |
|
@@ -178,7 +179,7 @@ def process_document_stream(
|
|
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 == "
|
182 |
else:
|
183 |
yield "Invalid model selected.", ""
|
184 |
return
|
@@ -235,7 +236,7 @@ def create_gradio_interface():
|
|
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", "
|
239 |
label="Select Model", value="LFM2-VL-1.6B"
|
240 |
)
|
241 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query")
|
|
|
22 |
Qwen2_5_VLForConditionalGeneration,
|
23 |
AutoModelForVision2Seq,
|
24 |
AutoModelForImageTextToText,
|
25 |
+
Gemma3ForConditionalGeneration,
|
26 |
AutoModel,
|
27 |
AutoProcessor,
|
28 |
TextIteratorStreamer,
|
|
|
78 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.float16
|
79 |
).to(device).eval()
|
80 |
|
81 |
+
MODEL_ID_I = "google/gemma-3-4b-it"
|
82 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
83 |
+
model_i = Gemma3ForConditionalGeneration.from_pretrained(
|
84 |
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
85 |
).to(device).eval()
|
86 |
|
|
|
179 |
elif model_name == "LFM2-VL-1.6B": processor, model = processor_t, model_t
|
180 |
elif model_name == "SmolVLM-Instruct-250M": processor, model = processor_c, model_c
|
181 |
elif model_name == "MonkeyOCR-Recognition": processor, model = processor_g, model_g
|
182 |
+
elif model_name == "gemma-3-4b-it": processor, model = processor_i, model_i
|
183 |
else:
|
184 |
yield "Invalid model selected.", ""
|
185 |
return
|
|
|
236 |
# Left Column (Inputs)
|
237 |
with gr.Column(scale=1):
|
238 |
model_choice = gr.Dropdown(
|
239 |
+
choices=["LFM2-VL-1.6B", "LFM2-VL-450M", "SmolVLM-Instruct-250M", "gemma-3-4b-it", "Megalodon-OCR-Sync-0713"],
|
240 |
label="Select Model", value="LFM2-VL-1.6B"
|
241 |
)
|
242 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query")
|