Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,6 @@ import cv2
|
|
15 |
|
16 |
from transformers import (
|
17 |
Qwen2_5_VLForConditionalGeneration,
|
18 |
-
Qwen2VLForConditionalGeneration,
|
19 |
AutoProcessor,
|
20 |
TextIteratorStreamer,
|
21 |
)
|
@@ -46,8 +45,8 @@ model_x = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
46 |
torch_dtype=torch.float16
|
47 |
).to(device).eval()
|
48 |
|
49 |
-
# Load
|
50 |
-
MODEL_ID_Z = "
|
51 |
processor_z = AutoProcessor.from_pretrained(MODEL_ID_Z, trust_remote_code=True)
|
52 |
model_z = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
53 |
MODEL_ID_Z,
|
@@ -92,7 +91,7 @@ def generate_image(model_name: str, text: str, image: Image.Image,
|
|
92 |
elif model_name == "docscopeOCR-7B-050425-exp":
|
93 |
processor = processor_x
|
94 |
model = model_x
|
95 |
-
elif model_name == "Captions
|
96 |
processor = processor_z
|
97 |
model = model_z
|
98 |
else:
|
@@ -146,7 +145,7 @@ def generate_video(model_name: str, text: str, video_path: str,
|
|
146 |
elif model_name == "docscopeOCR-7B-050425-exp":
|
147 |
processor = processor_x
|
148 |
model = model_x
|
149 |
-
elif model_name == "Captions
|
150 |
processor = processor_z
|
151 |
model = model_z
|
152 |
else:
|
@@ -247,7 +246,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
247 |
with gr.Column():
|
248 |
output = gr.Textbox(label="Output", interactive=False)
|
249 |
model_choice = gr.Radio(
|
250 |
-
choices=["Cosmos-Reason1-7B", "docscopeOCR-7B-050425-exp", "Captions
|
251 |
label="Select Model",
|
252 |
value="Cosmos-Reason1-7B"
|
253 |
)
|
|
|
15 |
|
16 |
from transformers import (
|
17 |
Qwen2_5_VLForConditionalGeneration,
|
|
|
18 |
AutoProcessor,
|
19 |
TextIteratorStreamer,
|
20 |
)
|
|
|
45 |
torch_dtype=torch.float16
|
46 |
).to(device).eval()
|
47 |
|
48 |
+
# Load Relaxed
|
49 |
+
MODEL_ID_Z = "Ertugrul/Qwen2.5-VL-7B-Captioner-Relaxed"
|
50 |
processor_z = AutoProcessor.from_pretrained(MODEL_ID_Z, trust_remote_code=True)
|
51 |
model_z = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
52 |
MODEL_ID_Z,
|
|
|
91 |
elif model_name == "docscopeOCR-7B-050425-exp":
|
92 |
processor = processor_x
|
93 |
model = model_x
|
94 |
+
elif model_name == "Relaxed-Captions":
|
95 |
processor = processor_z
|
96 |
model = model_z
|
97 |
else:
|
|
|
145 |
elif model_name == "docscopeOCR-7B-050425-exp":
|
146 |
processor = processor_x
|
147 |
model = model_x
|
148 |
+
elif model_name == "Relaxed-Captions":
|
149 |
processor = processor_z
|
150 |
model = model_z
|
151 |
else:
|
|
|
246 |
with gr.Column():
|
247 |
output = gr.Textbox(label="Output", interactive=False)
|
248 |
model_choice = gr.Radio(
|
249 |
+
choices=["Cosmos-Reason1-7B", "docscopeOCR-7B-050425-exp", "Relaxed-Captions"],
|
250 |
label="Select Model",
|
251 |
value="Cosmos-Reason1-7B"
|
252 |
)
|