File size: 660 Bytes
f6476f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from diffusers import DiffusionPipeline

# Load the diffusion pipeline
pipe = DiffusionPipeline.from_pretrained("jasperai/Flux.1-dev-Controlnet-Upscaler")

def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image

# Set up the Gradio interface
iface = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Prompt", placeholder="Enter a prompt..."),
    outputs=gr.Image(label="Generated Image"),
    title="Image Upscaler with ControlNet",
    description="Generate high-quality images using a diffusion model based on your text prompts."
)

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