sashavor commited on
Commit
2abad25
1 Parent(s): c7a61a0

adding app file

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ def gen_ims(prompt, im_prompt=None, seed=None, n_steps=10, method='plms'):
5
+ if seed == None :
6
+ seed = random.randint(0, 10000)
7
+ print( prompt, im_prompt, seed, n_steps)
8
+ prompts = [prompt]
9
+ im_prompts = []
10
+ if im_prompt != None:
11
+ im_prompts = [im_prompt]
12
+ pil_ims = generate(n=1, prompts=prompts, images=im_prompts, seed=seed, steps=n_steps, method=method)
13
+ return pil_ims[0]
14
+
15
+
16
+ with gr.Blocks() as demo:
17
+ gr.Markdown("# Stable Diffusion Explorer")
18
+ gr.Markdown("#### Try your hand at guessing the category of each image displayed, from the options provided. Compare your answers to that of a neural network trained on the dataset, and see if you can do better!")
19
+ with gr.Row():
20
+ with gr.Column():
21
+ gr.inputs.Textbox(label="Text prompt"),
22
+ gr.inputs.Image(optional=True, label="Image prompt", type='filepath'),
23
+ with gr.Column():
24
+ gr.inputs.Textbox(label="Text prompt"),
25
+ gr.inputs.Image(optional=True, label="Image prompt", type='filepath'),
26
+
27
+
28
+ demo.launch()