eder0782 commited on
Commit
55bf26f
·
verified ·
1 Parent(s): 60fe2b3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+ import torch
4
+
5
+ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16)
6
+ pipe.to("cuda" if torch.cuda.is_available() else "cpu")
7
+
8
+ def generate_image(prompt):
9
+ image = pipe(prompt).images[0]
10
+ return image
11
+
12
+ demo = gr.Interface(
13
+ fn=generate_image,
14
+ inputs=gr.Textbox(label="Prompt"),
15
+ outputs=gr.Image(type="pil"),
16
+ title="FLUX.1 - Schnell",
17
+ description="Gere imagens com o modelo FLUX.1 da Black Forest Labs"
18
+ )
19
+
20
+ demo.launch()