Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,6 @@ import cv2
|
|
| 16 |
from transformers import (
|
| 17 |
Qwen2_5_VLForConditionalGeneration,
|
| 18 |
Qwen2VLForConditionalGeneration,
|
| 19 |
-
Llama4ForConditionalGeneration,
|
| 20 |
AutoProcessor,
|
| 21 |
TextIteratorStreamer,
|
| 22 |
)
|
|
@@ -29,10 +28,10 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
| 29 |
|
| 30 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 31 |
|
| 32 |
-
# Load
|
| 33 |
-
MODEL_ID_M = "
|
| 34 |
processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
|
| 35 |
-
model_m =
|
| 36 |
MODEL_ID_M,
|
| 37 |
trust_remote_code=True,
|
| 38 |
torch_dtype=torch.float16
|
|
@@ -263,9 +262,9 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
| 263 |
with gr.Column():
|
| 264 |
output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
|
| 265 |
model_choice = gr.Radio(
|
| 266 |
-
choices=["
|
| 267 |
label="Select Model",
|
| 268 |
-
value="
|
| 269 |
)
|
| 270 |
|
| 271 |
image_submit.click(
|
|
|
|
| 16 |
from transformers import (
|
| 17 |
Qwen2_5_VLForConditionalGeneration,
|
| 18 |
Qwen2VLForConditionalGeneration,
|
|
|
|
| 19 |
AutoProcessor,
|
| 20 |
TextIteratorStreamer,
|
| 21 |
)
|
|
|
|
| 28 |
|
| 29 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 30 |
|
| 31 |
+
# Load typhoon
|
| 32 |
+
MODEL_ID_M = "scb10x/typhoon-ocr-7b"
|
| 33 |
processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
|
| 34 |
+
model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 35 |
MODEL_ID_M,
|
| 36 |
trust_remote_code=True,
|
| 37 |
torch_dtype=torch.float16
|
|
|
|
| 262 |
with gr.Column():
|
| 263 |
output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
|
| 264 |
model_choice = gr.Radio(
|
| 265 |
+
choices=["coreOCR-7B-050325-preview", "typhoon-ocr-7b", "Qwen2.5-VL-3B", "Imgscope-OCR-2B"],
|
| 266 |
label="Select Model",
|
| 267 |
+
value="coreOCR-7B-050325-preview"
|
| 268 |
)
|
| 269 |
|
| 270 |
image_submit.click(
|