Spaces:
Runtime error
Runtime error
Download app.py from Saurabhgk18/AdvancedStable-Diffusion: direct link, hf CLI and curl.
- Browser
- Download file 827 Bytes
-
https://huggingface.co/spaces/Saurabhgk18/AdvancedStable-Diffusion/resolve/main/app.py
- Command line
-
hf download hf://spaces/Saurabhgk18/AdvancedStable-Diffusion/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Saurabhgk18/AdvancedStable-Diffusion/resolve/main/app.py
827 Bytes
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| from transformers.utils.hub import move_cache | |
| move_cache() | |
| sdmodel=['stabilityai/stable-diffusion-2-1'] | |
| def T2I(Prompt,model): | |
| model_id = model | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id) | |
| pipe = pipe.to("cpu") | |
| prompt = Prompt | |
| image = pipe(prompt).images[0] | |
| return image | |
| desc = "The Models are running on Low processing power CPU'S. Which can take longer time to load!!!" | |
| import gradio as gr | |
| # css = ".gradio-container {background: rgb(0, 166, 228)}" | |
| interface = gr.Interface(fn=T2I, | |
| inputs=["text", gr.Dropdown(sdmodel)], | |
| outputs="image", | |
| title='Advanced Stable DiFFusion', | |
| description=desc | |
| ) | |
| interface.launch() |