Spaces:
Runtime error
Runtime error
import gradio as gr | |
from diffusers import DiffusionPipeline | |
# Initialize the DiffusionPipeline with the specified model | |
pipeline = DiffusionPipeline.from_pretrained("Lykon/dreamshaper-7") | |
pipeline.load_lora_weights("openskyml/midjourney-v4-xl") | |
# Function to generate image based on the prompt | |
def generate_image(prompt): | |
image = pipeline(prompt).images[0] | |
return image | |
# Define the Gradio interface layout | |
prompt_input = gr.Textbox(label="", placeholder="Enter your prompt here...", lines=1) | |
image_output = gr.Image(label="Generated Image") | |
# Create the Gradio interface with a more organized layout | |
gr.Interface( | |
fn=generate_image, | |
title="OpenJourney Image Generation", | |
theme="compact", # Use a more compact theme for the interface | |
inputs=[prompt_input], | |
outputs=image_output | |
).launch() | |