Spaces:
Runtime error
Runtime error
Update app.py
#2
by
tyzhaoqi
- opened
app.py
CHANGED
|
@@ -1,5 +1,21 @@
|
|
| 1 |
import os
|
| 2 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import datetime
|
| 4 |
import json
|
| 5 |
from typing import Optional
|
|
|
|
| 1 |
import os
|
| 2 |
import numpy as np
|
| 3 |
+
|
| 4 |
+
dynamic_modules_file2 = '/usr/local/lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py'
|
| 5 |
+
|
| 6 |
+
def modify_dynamic_modules_file(dynamic_modules_file):
|
| 7 |
+
if os.path.exists(dynamic_modules_file):
|
| 8 |
+
with open(dynamic_modules_file, 'r') as file:
|
| 9 |
+
lines = file.readlines()
|
| 10 |
+
with open(dynamic_modules_file, 'w') as file:
|
| 11 |
+
for line in lines:
|
| 12 |
+
if "cached_download" in line and "from huggingface_hub" in line:
|
| 13 |
+
file.write("from huggingface_hub import hf_hub_download, model_info\n")
|
| 14 |
+
else:
|
| 15 |
+
file.write(line)
|
| 16 |
+
|
| 17 |
+
modify_dynamic_modules_file(dynamic_modules_file2)
|
| 18 |
+
|
| 19 |
import datetime
|
| 20 |
import json
|
| 21 |
from typing import Optional
|