File size: 856 Bytes
63b52fb
 
b344955
 
63b52fb
 
f21b0bb
e7f6911
 
 
63b52fb
 
 
 
 
 
d028595
63b52fb
 
d028595
 
63b52fb
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from diffusers import DiffusionPipeline
import os
os.environ['HF_HOME'] = '/blabla/cache/'

# Load the diffusion model
pipe = DiffusionPipeline.from_pretrained("prompthero/openjourney-v4")




def generate_image(prompt):
    # Generate the image based on the prompt
    image = pipe(prompt).images[0]
    return image

# Create a Gradio interface using the new component style
iface = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g., Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"),
    outputs=gr.Image(type="pil", label="Generated Image"),
    title="Image Generation with SDXL-Lightning",
    description="Enter a prompt to generate an image using the SDXL-Lightning model."
)

# Launch the Gradio interface
if __name__ == "__main__":
    iface.launch()