Masssmarco commited on
Commit
c89bdff
·
verified ·
1 Parent(s): 9f6c217

requirements.txt

Browse files
Files changed (1) hide show
  1. requirements.txt +39 -0
requirements.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import spaces
2
+ import torch
3
+ import gradio as gr
4
+ from diffusers import DiffusionPipeline
5
+
6
+ MODEL = "black-forest-labs/FLUX.1-schnell"
7
+
8
+ pipe = DiffusionPipeline.from_pretrained(
9
+ MODEL,
10
+ torch_dtype=torch.bfloat16
11
+ ).to("cuda")
12
+
13
+
14
+ @spaces.GPU(duration=60)
15
+ def generate_image(prompt):
16
+ image = pipe(
17
+ prompt=prompt,
18
+ guidance_scale=0.0,
19
+ num_inference_steps=4,
20
+ height=768,
21
+ width=768,
22
+ max_sequence_length=256,
23
+ ).images[0]
24
+
25
+ return image
26
+
27
+
28
+ demo = gr.Interface(
29
+ fn=generate_image,
30
+ inputs=gr.Textbox(
31
+ label="Image Prompt",
32
+ placeholder="Describe the image you want..."
33
+ ),
34
+ outputs=gr.Image(label="Generated Image"),
35
+ title="AI Image Generator",
36
+ description="Enter a prompt and generate an image."
37
+ )
38
+
39
+ demo.launch()