Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -130,6 +130,13 @@ model_f = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
130 |
MODEL_ID_F, trust_remote_code=True, torch_dtype=torch.float16
|
131 |
).to(device).eval()
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
# --- PDF Generation and Preview Utility Function ---
|
134 |
def generate_and_preview_pdf(image: Image.Image, text_content: str, font_size: int, line_spacing: float, alignment: str, image_size: str):
|
135 |
"""
|
@@ -240,6 +247,7 @@ def process_document_stream(
|
|
240 |
elif model_name == "Megalodon-OCR-Sync-0713(ocr)": processor, model = processor_x, model_x
|
241 |
elif model_name == "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)": processor, model = processor_n, model_n
|
242 |
elif model_name == "LMM-R1-MGT-PerceReason(reason)": processor, model = processor_f, model_f
|
|
|
243 |
else:
|
244 |
yield "Invalid model selected.", ""
|
245 |
return
|
@@ -298,7 +306,7 @@ def create_gradio_interface():
|
|
298 |
model_choice = gr.Dropdown(
|
299 |
choices=["LFM2-VL-450M(fast)", "LFM2-VL-1.6B(fast)", "SmolVLM-Instruct-250M(smol)", "Moondream2(vision)", "ShotVL-3B(cinematic)", "Megalodon-OCR-Sync-0713(ocr)",
|
300 |
"VLAA-Thinker-Qwen2VL-2B(reason)", "MonkeyOCR-pro-1.2B(ocr)", "Qwen2.5-VL-3B-Abliterated-Caption-it(caption)", "Nanonets-OCR-s(ocr)",
|
301 |
-
"LMM-R1-MGT-PerceReason(reason)"],
|
302 |
label="Select Model", value= "LFM2-VL-450M(fast)"
|
303 |
)
|
304 |
prompt_input = gr.Textbox(label="Query Input", placeholder="✦︎ Enter your query", value="Describe the image!")
|
|
|
130 |
MODEL_ID_F, trust_remote_code=True, torch_dtype=torch.float16
|
131 |
).to(device).eval()
|
132 |
|
133 |
+
# TencentBAC/TBAC-VLR1-3B
|
134 |
+
MODEL_ID_G = "TencentBAC/TBAC-VLR1-3B"
|
135 |
+
processor_g = AutoProcessor.from_pretrained(MODEL_ID_G, trust_remote_code=True)
|
136 |
+
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 |
"""
|
|
|
247 |
elif model_name == "Megalodon-OCR-Sync-0713(ocr)": processor, model = processor_x, model_x
|
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 |
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!")
|