Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,18 @@ from share_btn import community_icon_html, loading_icon_html, share_js
|
|
| 13 |
# word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt")
|
| 14 |
# word_list = word_list_dataset["train"]['text']
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
is_gpu_busy = True
|
| 17 |
def infer(prompt, negative, scale):
|
| 18 |
global is_gpu_busy
|
|
@@ -28,7 +40,7 @@ def infer(prompt, negative, scale):
|
|
| 28 |
# image_b64 = (f"data:image/jpeg;base64,{image}")
|
| 29 |
# images.append(image_b64)
|
| 30 |
|
| 31 |
-
model_id = "
|
| 32 |
# Use the Euler scheduler here instead
|
| 33 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
| 34 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float32)
|
|
|
|
| 13 |
# word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt")
|
| 14 |
# word_list = word_list_dataset["train"]['text']
|
| 15 |
|
| 16 |
+
# 下载模型
|
| 17 |
+
base_dir = "/root/.cache/huggingface/hub"
|
| 18 |
+
if not os.path.isdir(base_dir):
|
| 19 |
+
os.makedirs(base_dir)
|
| 20 |
+
|
| 21 |
+
cmd_list = ["cd", base_dir, "&&", "git lfs install", "&&", "git clone", "https://gitee.com/modelee/stable-diffusion-2.git", "models"]
|
| 22 |
+
cmd_str = " ".join(cmd_list)
|
| 23 |
+
print("cmd_str:", cmd_str)
|
| 24 |
+
ret, out = subprocess.getstatusoutput(cmd_str)
|
| 25 |
+
print("ret:", ret)
|
| 26 |
+
print("out:", out)
|
| 27 |
+
|
| 28 |
is_gpu_busy = True
|
| 29 |
def infer(prompt, negative, scale):
|
| 30 |
global is_gpu_busy
|
|
|
|
| 40 |
# image_b64 = (f"data:image/jpeg;base64,{image}")
|
| 41 |
# images.append(image_b64)
|
| 42 |
|
| 43 |
+
model_id = base_dir +"models"
|
| 44 |
# Use the Euler scheduler here instead
|
| 45 |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
| 46 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float32)
|