Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from diffusers import DiffusionPipeline
|
| 3 |
+
|
| 4 |
+
# Load the diffusion pipeline
|
| 5 |
+
pipe = DiffusionPipeline.from_pretrained("jasperai/Flux.1-dev-Controlnet-Depth")
|
| 6 |
+
|
| 7 |
+
def generate_image(prompt):
|
| 8 |
+
image = pipe(prompt).images[0]
|
| 9 |
+
return image
|
| 10 |
+
|
| 11 |
+
# Set up the Gradio interface
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=generate_image,
|
| 14 |
+
inputs=gr.Textbox(label="Prompt", placeholder="Enter a prompt..."),
|
| 15 |
+
outputs=gr.Image(label="Generated Image"),
|
| 16 |
+
title="Diffusion Model Image Generator",
|
| 17 |
+
description="Generate images using a diffusion model based on your text prompts."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# Launch the app
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
iface.launch()
|