Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -92,18 +92,15 @@ model_i = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
92 |
|
93 |
#-----------------------------------------#
|
94 |
|
95 |
-
# Load
|
96 |
-
MODEL_ID_J = "
|
97 |
processor_j = AutoProcessor.from_pretrained(
|
98 |
MODEL_ID_J,
|
99 |
-
trust_remote_code=True
|
100 |
-
padding_side='left',
|
101 |
-
use_fast=True
|
102 |
)
|
103 |
model_j = AutoModelForVision2Seq.from_pretrained(
|
104 |
MODEL_ID_J,
|
105 |
trust_remote_code=True,
|
106 |
-
attn_implementation="flash_attention_2",
|
107 |
torch_dtype=torch.float16
|
108 |
).to(device).eval()
|
109 |
#-----------------------------------------#
|
@@ -158,7 +155,7 @@ def process_document_stream(model_name: str, task_choice: str, image: Image.Imag
|
|
158 |
elif model_name == "Nanonets-OCR-s": processor, model = processor_c, model_c
|
159 |
elif model_name == "MonkeyOCR-Recognition": processor, model = processor_g, model_g
|
160 |
elif model_name == "olmOCR-7B-0725": processor, model = processor_i, model_i
|
161 |
-
elif model_name == "
|
162 |
else:
|
163 |
yield "Invalid model selected.", "Invalid model selected.", None
|
164 |
return
|
@@ -228,7 +225,8 @@ def create_gradio_interface():
|
|
228 |
"olmOCR-7B-0725",
|
229 |
"Nanonets-OCR-s",
|
230 |
"NuExtract-2.0-4B",
|
231 |
-
"Megalodon-OCR-Sync-0713"
|
|
|
232 |
],
|
233 |
label="Select Model", value="Nanonets-OCR-s"
|
234 |
)
|
|
|
92 |
|
93 |
#-----------------------------------------#
|
94 |
|
95 |
+
# Load prithivMLmods/DREX-062225-exp
|
96 |
+
MODEL_ID_J = "prithivMLmods/DREX-062225-exp"
|
97 |
processor_j = AutoProcessor.from_pretrained(
|
98 |
MODEL_ID_J,
|
99 |
+
trust_remote_code=True
|
|
|
|
|
100 |
)
|
101 |
model_j = AutoModelForVision2Seq.from_pretrained(
|
102 |
MODEL_ID_J,
|
103 |
trust_remote_code=True,
|
|
|
104 |
torch_dtype=torch.float16
|
105 |
).to(device).eval()
|
106 |
#-----------------------------------------#
|
|
|
155 |
elif model_name == "Nanonets-OCR-s": processor, model = processor_c, model_c
|
156 |
elif model_name == "MonkeyOCR-Recognition": processor, model = processor_g, model_g
|
157 |
elif model_name == "olmOCR-7B-0725": processor, model = processor_i, model_i
|
158 |
+
elif model_name == "Drex-062225-OCR": processor, model = processor_j, model_j
|
159 |
else:
|
160 |
yield "Invalid model selected.", "Invalid model selected.", None
|
161 |
return
|
|
|
225 |
"olmOCR-7B-0725",
|
226 |
"Nanonets-OCR-s",
|
227 |
"NuExtract-2.0-4B",
|
228 |
+
"Megalodon-OCR-Sync-0713",
|
229 |
+
"Drex-062225-OCR"
|
230 |
],
|
231 |
label="Select Model", value="Nanonets-OCR-s"
|
232 |
)
|