Spaces:
Runtime error
Runtime error
Download app.py from mashdemy/MashdemyAI_Image_Generator: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/spaces/mashdemy/MashdemyAI_Image_Generator/resolve/main/app.py
- Command line
-
hf download hf://spaces/mashdemy/MashdemyAI_Image_Generator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mashdemy/MashdemyAI_Image_Generator/resolve/main/app.py
639 Bytes
| from diffusers import DiffusionPipeline | |
| import gradio as gr | |
| model_id = "CompVis/ldm-text2im-large-256" | |
| # load text input to diffusion pipeline | |
| ldm = DiffusionPipeline.from_pretrained(model_id) | |
| def generate_image(Prompt): | |
| images = ldm([Prompt], num_inference_steps=50, eta=.3, guidance_scale=6) | |
| return images.images[0] | |
| interface = gr.Interface(fn = generate_image,inputs = "text",outputs = "image",title = "Mashdemy Demo Image Generator App", description = "Type in a text and click submit to generate an image:", examples = ["a clown reading a book", "a cat using a laptop", "An elephant on grass"]) | |
| interface.launch(share = True) |