Manual test.
Browse files
app.py
CHANGED
@@ -29,6 +29,23 @@ BOOLPARM = {
|
|
29 |
}
|
30 |
SLPDL = 5 # Seconds to wait between downloads - eases strain on the servers.
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
def download_file(url, file_path, folder, api_key=None):
|
33 |
headers = {}
|
34 |
full_path = os.path.join(folder, file_path)
|
@@ -113,17 +130,36 @@ def get_files_by_username(username, api_key=None, nsfw=None, hidden=None):
|
|
113 |
if api_key:
|
114 |
headers['Authorization'] = f'Bearer {api_key}'
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
return (output, images)
|
128 |
|
129 |
def get_files_by_model_id(model_id, api_key=None):
|
|
|
29 |
}
|
30 |
SLPDL = 5 # Seconds to wait between downloads - eases strain on the servers.
|
31 |
|
32 |
+
LFILES = [
|
33 |
+
(347770, 1699147, 'LYD14V WAN [nyxmvy1966017adb5n212].safetensors', 'https://civitai.com/api/download/models/1589151', 'lydiaviolet', 'v1.0 - WAN', 'loradude'),
|
34 |
+
(347770, 1354420, 'LYD14V [sjuilw194b3926f79r36].safetensors', 'https://civitai.com/api/download/models/1589151', 'lydiaviolet', 'v1.0 - Hunyuan', 'loradude'),
|
35 |
+
(800207, 894765, 'L0V3PS [iynhxz1922e423cf4m3c34].safetensors', 'https://civitai.com/api/download/models/1589151', 'love poem society', 'v1.0 - FLUX', 'loradude'),
|
36 |
+
]
|
37 |
+
LIMAGES = [
|
38 |
+
(347770, 1699147, 'LYD14V WAN [nyxmvy1966017adb5n212]-ID71853934.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/e555f3d4-552a-4190-8492-a50841b13a60/width=1800/71853934.mp4', 'lydiaviolet', 'v1.0 - WAN', 'loradude'),
|
39 |
+
(347770, 1699147, 'LYD14V WAN [nyxmvy1966017adb5n212]-ID71853957.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/76775664-eb16-479b-bb52-f3998622763b/width=1800/71853957.mp4', 'lydiaviolet', 'v1.0 - WAN', 'loradude'),
|
40 |
+
(347770, 1699147, 'LYD14V WAN [nyxmvy1966017adb5n212]-ID71853943.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/cfe29850-4cb1-4df5-8d6a-e0fc0d7eaf32/width=1800/71853943.mp4', 'lydiaviolet', 'v1.0 - WAN', 'loradude'),
|
41 |
+
(347770, 1354420, 'LYD14V [sjuilw194b3926f79r36]-ID54975000.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/954feb82-5739-420f-81d4-4f050bc06e93/width=1800/54975000.mp4', 'lydiaviolet', 'v1.0 - Hunyuan', 'loradude'),
|
42 |
+
(347770, 1354420, 'LYD14V [sjuilw194b3926f79r36]-ID54975007.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/5d2514f0-3cad-4825-a77c-a89597e09d0f/width=1800/54975007.mp4', 'lydiaviolet', 'v1.0 - Hunyuan', 'loradude'),
|
43 |
+
(347770, 1354420, 'LYD14V [sjuilw194b3926f79r36]-ID54974984.preview.mp4', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/8bc84a09-8e7c-40dc-bf0c-ec474b176d95/width=1800/54974984.mp4', 'lydiaviolet', 'v1.0 - Hunyuan', 'loradude'),
|
44 |
+
(800207, 894765, 'L0V3PS [iynhxz1922e423cf4m3c34]-ID31480207.preview.jpeg', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/5a653b4c-74e6-45a6-8866-c49cddb32267/width=1792/31480207.jpeg', 'love poem society', 'v1.0 - FLUX', 'loradude'),
|
45 |
+
(800207, 894765, 'L0V3PS [iynhxz1922e423cf4m3c34]-ID31480211.preview.jpeg', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/173e94e7-a266-4c30-b5a1-a9b1a689ea6b/width=1792/31480211.jpeg', 'love poem society', 'v1.0 - FLUX', 'loradude'),
|
46 |
+
(800207, 894765, 'L0V3PS [iynhxz1922e423cf4m3c34]-ID31480209.preview.jpeg', 'https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/dd2a0e14-a54e-494f-9ad2-d0e7009eb622/width=1792/31480209.jpeg', 'love poem society', 'v1.0 - FLUX', 'loradude'),
|
47 |
+
]
|
48 |
+
|
49 |
def download_file(url, file_path, folder, api_key=None):
|
50 |
headers = {}
|
51 |
full_path = os.path.join(folder, file_path)
|
|
|
130 |
if api_key:
|
131 |
headers['Authorization'] = f'Bearer {api_key}'
|
132 |
|
133 |
+
for file in LFILES:
|
134 |
+
(model_id, version_id, file_name, file_url, model_name, version_name, model_username) = file
|
135 |
+
output[str(model_id) + '/' + str(version_id) + '/' + file_name] = {
|
136 |
+
'rawModelId': model_id,
|
137 |
+
'rawVersionId': version_id,
|
138 |
+
'rawFilename': file_name,
|
139 |
+
'downloadUrl': file_url,
|
140 |
+
'modelId': model_name + ' - ' + version_name, # Not used?
|
141 |
+
'modelUrl': f"https://civitai.com/models/{model_id}?modelVersionId={version_id}",
|
142 |
+
'author': model_username,
|
143 |
+
'authorUrl': f"https://civitai.com/user/{model_username}",
|
144 |
+
'mirrorUrl': f"https://civitaiarchive.com/models/{model_id}?modelVersionId={version_id}",
|
145 |
+
|
146 |
+
for image in LIMAGES:
|
147 |
+
(model_id, version_id, image_name, image_url, model_name, version_name, model_username) = file
|
148 |
+
# Image ids can be used for direct access,
|
149 |
+
# but we also need to rename them to the model file to give an indication of attachment.
|
150 |
+
imagename = image_name
|
151 |
+
images[str(model_id) + '/' + str(version_id) + '/' + imagename] = {
|
152 |
+
'rawModelId': model_id,
|
153 |
+
'rawVersionId': version_id,
|
154 |
+
'rawFilename': imagename,
|
155 |
+
'downloadUrl': image_url,
|
156 |
+
'modelId': model_name + ' - ' + version_name, # Not used?
|
157 |
+
'modelUrl': f"https://civitai.com/models/{model_id}?modelVersionId={version_id}",
|
158 |
+
'author': model_username,
|
159 |
+
'authorUrl': f"https://civitai.com/user/{model_username}",
|
160 |
+
'mirrorUrl': f"https://civitaiarchive.com/models/{model_id}?modelVersionId={version_id}",
|
161 |
+
}
|
162 |
+
|
163 |
return (output, images)
|
164 |
|
165 |
def get_files_by_model_id(model_id, api_key=None):
|