Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,43 +1,22 @@
|
|
1 |
-
import
|
2 |
-
from
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
os.system(f"sed -i -e 's/ outputs=\[/queue=False, &/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
|
24 |
-
os.system(f"sed -i -e 's/ queue=False, / /g' /home/user/app/stable-diffusion-webui/modules/ui.py")
|
25 |
-
|
26 |
-
# ----------------------------Please duplicate this space and delete this block if you don't want to see the extra header----------------------------
|
27 |
-
# os.system(f"wget -q https://github.com/camenduru/webui/raw/main/header_patch.py -O /home/user/app/header_patch.py")
|
28 |
-
# os.system(f"sed -i -e '/demo:/r /home/user/app/header_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
|
29 |
-
# ---------------------------------------------------------------------------------------------------------------------------------------------------
|
30 |
-
|
31 |
-
os.system(f"rm -rfv /home/user/app/stable-diffusion-webui/scripts/")
|
32 |
-
|
33 |
-
os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-config.json -O /home/user/app/shared-config.json")
|
34 |
-
os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-ui-config.json -O /home/user/app/shared-ui-config.json")
|
35 |
-
|
36 |
-
# os.system(f"wget -q https://huggingface.co/DucHaiten/DucHaitenAIart/resolve/main/DucHaitenAIart_v2.0.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/DucHaitenAIart_v2.0-emaonly.safetensors")
|
37 |
-
os.system(f"wget -q https://huggingface.co/DucHaiten/DucHaitenDreamWorld/resolve/main/DucHaitenDreamWorld_v2.4.1.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/DucHaitenDreamWorld_v2.4.1.safetensors")
|
38 |
-
os.system(f"wget -q https://huggingface.co/DucHaiten/DucHaitenAnime/resolve/main/DucHaitenAnime_v4.0.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/DucHaitenAnime_v4.0.safetensors")
|
39 |
-
os.system(f"wget -q https://huggingface.co/DucHaiten/DucHaitenAnimated/resolve/main/DucHaitenAnimated_v5.0.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/DucHaitenAnimated_v5.0.safetensors")
|
40 |
-
os.system(f"wget -q https://huggingface.co/DucHaiten/DucHaitenAIart/resolve/main/DucHaitenAIart_v3.1.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/DucHaitenAIart_v3.1.safetensors")
|
41 |
-
os.system(f"wget -q https://huggingface.co/userdiffuser/cyberrealistic_v13/resolve/main/cyberrealistic_v13.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Deliberate.safetensors")
|
42 |
-
|
43 |
-
os.system(f"python launch.py --skip-torch-cuda-test --force-enable-xformers --ui-config-file /home/user/app/ui-config.json --ui-settings-file /home/user/app/config.json --disable-console-progressbars --enable-console-prompts --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding --api")
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
generator = DiffusionPipeline.from_pretrained("Mousewrites/charTurner")
|
6 |
+
# move to GPU if available
|
7 |
+
if torch.cuda.is_available():
|
8 |
+
generator = generator.to("cuda")
|
9 |
+
|
10 |
+
def generate(prompts):
|
11 |
+
images = generator(list(prompts)).images
|
12 |
+
return [images]
|
13 |
+
|
14 |
+
demo = gr.Interface(generate,
|
15 |
+
"textbox",
|
16 |
+
"image",
|
17 |
+
batch=True,
|
18 |
+
max_batch_size=1 # Set the batch size based on your CPU/GPU memory
|
19 |
+
).queue()
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|