Spaces:
Running on Zero
Running on Zero
wjm55 commited on
Commit ·
2b2bd20
1
Parent(s): 2f86d0f
Update model references to Qwen2.5-VL-7B-Instruct
Browse files
app.py
CHANGED
|
@@ -49,12 +49,12 @@ def array_to_image_path(image_array):
|
|
| 49 |
return full_path
|
| 50 |
|
| 51 |
models = {
|
| 52 |
-
"Qwen2.5-VL-7B-Instruct": Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen2.5-VL-7B-Instruct", trust_remote_code=True, torch_dtype="auto").cuda().eval()
|
| 53 |
|
| 54 |
}
|
| 55 |
|
| 56 |
processors = {
|
| 57 |
-
"Qwen2.5-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen2.5-VL-7B-Instruct", trust_remote_code=True)
|
| 58 |
}
|
| 59 |
|
| 60 |
DESCRIPTION = "This demo uses[Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)"
|
|
@@ -67,7 +67,7 @@ assistant_prompt = '<|assistant|>\n'
|
|
| 67 |
prompt_suffix = "<|end|>\n"
|
| 68 |
|
| 69 |
@spaces.GPU
|
| 70 |
-
def run_example(image, model_id="Qwen/Qwen2-VL-7B-Instruct", run_ner=False, ner_labels=DEFAULT_NER_LABELS):
|
| 71 |
# First get the OCR text
|
| 72 |
text_input = "Convert the image to text."
|
| 73 |
image_path = array_to_image_path(image)
|
|
@@ -235,7 +235,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 235 |
with gr.Row():
|
| 236 |
with gr.Column(elem_classes="input-container"):
|
| 237 |
input_img = gr.Image(label="Input Picture", elem_classes="gr-image-input")
|
| 238 |
-
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value="Qwen/Qwen2-VL-7B-Instruct", elem_classes="gr-dropdown")
|
| 239 |
|
| 240 |
# Add NER controls
|
| 241 |
with gr.Row():
|
|
|
|
| 49 |
return full_path
|
| 50 |
|
| 51 |
models = {
|
| 52 |
+
"Qwen/Qwen2.5-VL-7B-Instruct": Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct", trust_remote_code=True, torch_dtype="auto").cuda().eval()
|
| 53 |
|
| 54 |
}
|
| 55 |
|
| 56 |
processors = {
|
| 57 |
+
"Qwen/Qwen2.5-VL-7B-Instruct": AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct", trust_remote_code=True)
|
| 58 |
}
|
| 59 |
|
| 60 |
DESCRIPTION = "This demo uses[Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)"
|
|
|
|
| 67 |
prompt_suffix = "<|end|>\n"
|
| 68 |
|
| 69 |
@spaces.GPU
|
| 70 |
+
def run_example(image, model_id="Qwen/Qwen2.5-VL-7B-Instruct", run_ner=False, ner_labels=DEFAULT_NER_LABELS):
|
| 71 |
# First get the OCR text
|
| 72 |
text_input = "Convert the image to text."
|
| 73 |
image_path = array_to_image_path(image)
|
|
|
|
| 235 |
with gr.Row():
|
| 236 |
with gr.Column(elem_classes="input-container"):
|
| 237 |
input_img = gr.Image(label="Input Picture", elem_classes="gr-image-input")
|
| 238 |
+
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value="Qwen/Qwen2.5-VL-7B-Instruct", elem_classes="gr-dropdown")
|
| 239 |
|
| 240 |
# Add NER controls
|
| 241 |
with gr.Row():
|