Update app.py
Browse files
app.py
CHANGED
|
@@ -19,24 +19,24 @@ _SYSTEM = "Based on the screenshot of the page, I give a text description and yo
|
|
| 19 |
MIN_PIXELS = 256 * 28 * 28
|
| 20 |
MAX_PIXELS = 1344 * 28 * 28
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 38 |
-
|
| 39 |
-
"showlab/ShowUI-2B",
|
| 40 |
torch_dtype=torch.bfloat16,
|
| 41 |
device_map="cpu",
|
| 42 |
)
|
|
|
|
| 19 |
MIN_PIXELS = 256 * 28 * 28
|
| 20 |
MAX_PIXELS = 1344 * 28 * 28
|
| 21 |
|
| 22 |
+
# Specify the model repository and destination folder
|
| 23 |
+
model_repo = "showlab/ShowUI-2B"
|
| 24 |
+
destination_folder = "./showui-2b"
|
| 25 |
|
| 26 |
+
# Ensure the destination folder exists
|
| 27 |
+
os.makedirs(destination_folder, exist_ok=True)
|
| 28 |
|
| 29 |
+
# List all files in the repository
|
| 30 |
+
files = list_repo_files(repo_id=model_repo)
|
| 31 |
|
| 32 |
+
# Download each file to the destination folder
|
| 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 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 38 |
+
"./showui-2b",
|
| 39 |
+
# "showlab/ShowUI-2B",
|
| 40 |
torch_dtype=torch.bfloat16,
|
| 41 |
device_map="cpu",
|
| 42 |
)
|