Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import ast
|
|
11 |
import os
|
12 |
from datetime import datetime
|
13 |
import numpy as np
|
14 |
-
from huggingface_hub import
|
15 |
|
16 |
# Define constants
|
17 |
DESCRIPTION = "[ShowUI Demo](https://huggingface.co/showlab/ShowUI-2B)"
|
@@ -29,7 +29,20 @@ model = Qwen2VLForConditionalGeneration.from_pretrained(
|
|
29 |
# Load the processor
|
30 |
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=MIN_PIXELS, max_pixels=MAX_PIXELS)
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
# Helper functions
|
35 |
def draw_point(image_input, point=None, radius=5):
|
|
|
11 |
import os
|
12 |
from datetime import datetime
|
13 |
import numpy as np
|
14 |
+
from huggingface_hub import hf_hub_download, list_repo_files
|
15 |
|
16 |
# Define constants
|
17 |
DESCRIPTION = "[ShowUI Demo](https://huggingface.co/showlab/ShowUI-2B)"
|
|
|
29 |
# Load the processor
|
30 |
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=MIN_PIXELS, max_pixels=MAX_PIXELS)
|
31 |
|
32 |
+
# Specify the model repository and destination folder
|
33 |
+
model_repo = "showlab/ShowUI-2B"
|
34 |
+
destination_folder = "./showui-2b"
|
35 |
+
|
36 |
+
# Ensure the destination folder exists
|
37 |
+
os.makedirs(destination_folder, exist_ok=True)
|
38 |
+
|
39 |
+
# List all files in the repository
|
40 |
+
files = list_repo_files(repo_id=model_repo)
|
41 |
+
|
42 |
+
# Download each file to the destination folder
|
43 |
+
for file in files:
|
44 |
+
file_path = hf_hub_download(repo_id=model_repo, filename=file, local_dir=destination_folder)
|
45 |
+
print(f"Downloaded {file} to {file_path}")
|
46 |
|
47 |
# Helper functions
|
48 |
def draw_point(image_input, point=None, radius=5):
|