Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -137,6 +137,13 @@ model_g = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
137 |
MODEL_ID_G, trust_remote_code=True, torch_dtype=torch.float16
|
138 |
).to(device).eval()
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
# --- PDF Generation and Preview Utility Function ---
|
141 |
def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
|
142 |
"""
|
@@ -248,6 +255,7 @@ def process_document_stream(
|
|
248 |
elif model_name == "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)": processor, model = processor_n, model_n
|
249 |
elif model_name == "LMM-R1-MGT-PerceReason(reason)": processor, model = processor_f, model_f
|
250 |
elif model_name == "TBAC-VLR1-3B(open-r1)": processor, model = processor_g, model_g
|
|
|
251 |
else:
|
252 |
yield "Invalid model selected.", ""
|
253 |
return
|
@@ -306,7 +314,7 @@ def create_gradio_interface():
|
|
306 |
model_choice = gr.Dropdown(
|
307 |
choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
|
308 |
"VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)", "Nanonets-OCR-s(ocr)",
|
309 |
-
"LMM-R1-MGT-PerceReason(reason)", "TBAC-VLR1-3B(open-r1)"],
|
310 |
label="Select Model", value= "LFM2-VL-450M(fast)"
|
311 |
)
|
312 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")
|
|
|
137 |
MODEL_ID_G, trust_remote_code=True, torch_dtype=torch.float16
|
138 |
).to(device).eval()
|
139 |
|
140 |
+
# OCRFlux-3B
|
141 |
+
MODEL_ID_V = "ChatDOC/OCRFlux-3B"
|
142 |
+
processor_v = AutoProcessor.from_pretrained(MODEL_ID_V, trust_remote_code=True)
|
143 |
+
model_v = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
144 |
+
MODEL_ID_V, trust_remote_code=True, torch_dtype=torch.float16
|
145 |
+
).to(device).eval()
|
146 |
+
|
147 |
# --- PDF Generation and Preview Utility Function ---
|
148 |
def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
|
149 |
"""
|
|
|
255 |
elif model_name == "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)": processor, model = processor_n, model_n
|
256 |
elif model_name == "LMM-R1-MGT-PerceReason(reason)": processor, model = processor_f, model_f
|
257 |
elif model_name == "TBAC-VLR1-3B(open-r1)": processor, model = processor_g, model_g
|
258 |
+
elif model_name == "OCRFlux-3B(ocr)": processor, model = processor_v, modelv
|
259 |
else:
|
260 |
yield "Invalid model selected.", ""
|
261 |
return
|
|
|
314 |
model_choice = gr.Dropdown(
|
315 |
choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
|
316 |
"VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)", "Nanonets-OCR-s(ocr)",
|
317 |
+
"LMM-R1-MGT-PerceReason(reason)", "TBAC-VLR1-3B(open-r1)", "OCRFlux-3B(ocr)"],
|
318 |
label="Select Model", value= "LFM2-VL-450M(fast)"
|
319 |
)
|
320 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")
|