Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import os
|
|
8 |
|
9 |
# subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
10 |
|
11 |
-
DESCRIPTION = "[Sparrow Qwen2-VL-
|
12 |
|
13 |
|
14 |
def array_to_image_path(image_filepath, max_width=1250, max_height=1750):
|
@@ -61,12 +61,12 @@ def array_to_image_path(image_filepath, max_width=1250, max_height=1750):
|
|
61 |
|
62 |
# Initialize the model and processor globally to optimize performance
|
63 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
64 |
-
"Qwen/Qwen2-VL-
|
65 |
torch_dtype="auto",
|
66 |
device_map="auto"
|
67 |
)
|
68 |
|
69 |
-
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-
|
70 |
|
71 |
|
72 |
@spaces.GPU
|
@@ -140,7 +140,7 @@ css = """
|
|
140 |
|
141 |
with gr.Blocks(css=css) as demo:
|
142 |
gr.Markdown(DESCRIPTION)
|
143 |
-
with gr.Tab(label="Qwen2-VL-
|
144 |
with gr.Row():
|
145 |
with gr.Column():
|
146 |
input_imgs = gr.Files(file_types=["image"], label="Upload Document Images")
|
|
|
8 |
|
9 |
# subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
10 |
|
11 |
+
DESCRIPTION = "[Sparrow Qwen2-VL-2B Backend](https://github.com/katanaml/sparrow)"
|
12 |
|
13 |
|
14 |
def array_to_image_path(image_filepath, max_width=1250, max_height=1750):
|
|
|
61 |
|
62 |
# Initialize the model and processor globally to optimize performance
|
63 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
64 |
+
"Qwen/Qwen2-VL-2B-Instruct",
|
65 |
torch_dtype="auto",
|
66 |
device_map="auto"
|
67 |
)
|
68 |
|
69 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")
|
70 |
|
71 |
|
72 |
@spaces.GPU
|
|
|
140 |
|
141 |
with gr.Blocks(css=css) as demo:
|
142 |
gr.Markdown(DESCRIPTION)
|
143 |
+
with gr.Tab(label="Qwen2-VL-2B Input"):
|
144 |
with gr.Row():
|
145 |
with gr.Column():
|
146 |
input_imgs = gr.Files(file_types=["image"], label="Upload Document Images")
|