Spaces:
Runtime error
Runtime error
Download app.py from B-ID-Creativity/BID-Creativity-Generator: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/spaces/B-ID-Creativity/BID-Creativity-Generator/resolve/main/app.py
- Command line
-
hf download hf://spaces/B-ID-Creativity/BID-Creativity-Generator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/B-ID-Creativity/BID-Creativity-Generator/resolve/main/app.py
686 Bytes
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| # Initialisation du pipeline Stable Diffusion en CPU | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| "runwayml/stable-diffusion-v1-5", | |
| torch_dtype=torch.float32 | |
| ) | |
| pipe = pipe.to("cpu") | |
| def generate_image(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| # Création de l'interface Gradio | |
| demo = gr.Interface( | |
| fn=generate_image, | |
| inputs=gr.Textbox(label="Prompt"), | |
| outputs=gr.Image(label="Generated Image"), | |
| title="BID Creativity Generator", | |
| description="Générateur d'images Stable Diffusion CPU" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0") |