Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -202,6 +202,13 @@ with gr.Blocks() as demo:
|
|
| 202 |
polish_button.click(get_image, inputs=[height, width, seed, prompt, cfg, timesteps, stage_a_tiled], outputs=output_img)
|
| 203 |
polish_button.click(clear_image, inputs=[], outputs=output_img)
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
def download_model():
|
| 206 |
urls = [
|
| 207 |
'https://huggingface.co/stabilityai/StableWurst/resolve/main/stage_a.safetensors',
|
|
@@ -212,13 +219,7 @@ def download_model():
|
|
| 212 |
'https://huggingface.co/roubaofeipi/UltraPixel/blob/main/ultrapixel_t2i.safetensors'
|
| 213 |
]
|
| 214 |
for file_url in urls:
|
| 215 |
-
|
| 216 |
-
response = requests.get(file_url)
|
| 217 |
-
if response.status_code == 200:
|
| 218 |
-
file_path = os.path.join('models', file_url.split('/')[-1])
|
| 219 |
-
with open(file_path, "wb") as f:
|
| 220 |
-
f.write(response.content)
|
| 221 |
-
print('download successful! ', file_path)
|
| 222 |
if __name__ == "__main__":
|
| 223 |
|
| 224 |
args = parse_args()
|
|
|
|
| 202 |
polish_button.click(get_image, inputs=[height, width, seed, prompt, cfg, timesteps, stage_a_tiled], outputs=output_img)
|
| 203 |
polish_button.click(clear_image, inputs=[], outputs=output_img)
|
| 204 |
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def download_and_save_model(model_name_or_path, save_directory):
|
| 208 |
+
from transformers import AutoModel
|
| 209 |
+
model = AutoModel.from_pretrained(model_name_or_path)
|
| 210 |
+
model.save_pretrained(save_directory)
|
| 211 |
+
print(f"Model saved to {save_directory}", model_name_or_path)
|
| 212 |
def download_model():
|
| 213 |
urls = [
|
| 214 |
'https://huggingface.co/stabilityai/StableWurst/resolve/main/stage_a.safetensors',
|
|
|
|
| 219 |
'https://huggingface.co/roubaofeipi/UltraPixel/blob/main/ultrapixel_t2i.safetensors'
|
| 220 |
]
|
| 221 |
for file_url in urls:
|
| 222 |
+
download_and_save_model(file_url, 'models')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
if __name__ == "__main__":
|
| 224 |
|
| 225 |
args = parse_args()
|