Mohamed Rashad commited on
Commit
0d823ff
·
1 Parent(s): b610eb1

Add application

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ pipe = StableDiffusionPipeline.from_pretrained("MohamedRashad/diffusion_fashion", torch_dtype=torch.float16)
6
+ pipe.to("cuda")
7
+
8
+ def generate_image(text):
9
+ images = pipe(text).images
10
+ image = images[0]
11
+ return image
12
+
13
+ diffusion_interface = gr.Interface(
14
+ generate_image,
15
+ gr.Textbox(lines=1, label="Input"),
16
+ gr.outputs.Image(type="pil", label="Output"),
17
+ title="Diffusion4Fashion: Generate cool clothes!",
18
+ description="<center><p>Enter a description about a piece of cloth and the model will generate an image.</p></center>",
19
+ examples=["A photo of a dress, made in 2019, color is Red, Casual usage, Women's cloth, something for the summer season, on white background"],
20
+ cache_examples=True,
21
+ )
22
+
23
+ diffusion_interface.launch()