Manjushri commited on
Commit
07d5247
1 Parent(s): 4ba7925

Create new file

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from stable_diffusion_tf.stable_diffusion import Text2Image
2
+ from PIL import Image
3
+ import gradio as gr
4
+
5
+ generator = Text2Image(
6
+ img_height=512,
7
+ img_width=512,
8
+ jit_compile=False,
9
+ )
10
+
11
+ def txt2img(prompt, guide, steps, temp)
12
+ img = generator.generate(prompt,
13
+ num_steps=150,
14
+ unconditional_guidance_scale=15,
15
+ temperature=3,
16
+ batch_size=1)
17
+ image=Image.fromarray(img[0])
18
+ return image
19
+
20
+ iface = gr.Interface(fn=txt2img inputs=[
21
+ gr.Textbox(label = 'Input Text Prompt'),
22
+ gr.Slider(2, 20, value = 9, label = 'Guidence Scale'),
23
+ gr.Slider(10, 100, value = 50, step = 1, label = 'Number of Iterations'),
24
+ gr.Slider(1, 33, value=1, step=1)], outputs = 'image')
25
+ iface.launch()