Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| model_id = "prompthero/openjourney" | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32) | |
| def generate_image(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| iface = gr.Interface( | |
| fn=generate_image, | |
| inputs=gr.Textbox(prompt="Enter a prompt:"), | |
| outputs=gr.Image(), | |
| title="Image Generation Model", | |
| description="Generate images from text prompts using the OpenJourney model.", | |
| ) | |
| iface.launch() | |