Update app.py
Browse files
app.py
CHANGED
@@ -33,16 +33,22 @@ files = list_repo_files(repo_id=model_repo)
|
|
33 |
for file in files:
|
34 |
file_path = hf_hub_download(repo_id=model_repo, filename=file, local_dir=destination_folder)
|
35 |
print(f"Downloaded {file} to {file_path}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
# Load the
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
)
|
43 |
-
|
44 |
-
# Load the processor
|
45 |
-
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=MIN_PIXELS, max_pixels=MAX_PIXELS)
|
46 |
|
47 |
# Helper functions
|
48 |
def draw_point(image_input, point=None, radius=5):
|
|
|
33 |
for file in files:
|
34 |
file_path = hf_hub_download(repo_id=model_repo, filename=file, local_dir=destination_folder)
|
35 |
print(f"Downloaded {file} to {file_path}")
|
36 |
+
|
37 |
+
@spaces.GPU
|
38 |
+
def get_model_processor():
|
39 |
+
# Load the model
|
40 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
41 |
+
"./showui-2b",
|
42 |
+
torch_dtype=torch.bfloat16,
|
43 |
+
device_map="auto",
|
44 |
+
)
|
45 |
|
46 |
+
# Load the processor
|
47 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=MIN_PIXELS, max_pixels=MAX_PIXELS)
|
48 |
+
|
49 |
+
return model, proecessor
|
50 |
+
|
51 |
+
model, processor = get_model_processor()
|
|
|
|
|
|
|
52 |
|
53 |
# Helper functions
|
54 |
def draw_point(image_input, point=None, radius=5):
|