fffiloni commited on
Commit
db12400
1 Parent(s): c8fbbfe

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ pix2pix = gr.Blocks.load(name="spaces/patrickvonplaten/instruct-pix2pix")
4
+
5
+ def infer(prompt,image):
6
+ result = pix2pix(prompt,
7
+ 5.5,
8
+ 1.5,
9
+ image,
10
+ 15,
11
+ "",
12
+ 512,
13
+ 512,
14
+ 0,
15
+ fn_index=0)
16
+
17
+ print(result)
18
+ return result[0]
19
+
20
+ with gr.Block() as demo:
21
+ with gr.Column():
22
+ prompt = gr.Textbox(placeholder="enter prompt")
23
+ image = gr.Image(source="upload", type="filepath")
24
+ gallery_out = gr.Gallery()
25
+ submit_btn = gr.Button("go")
26
+
27
+ inputs = [
28
+ prompt,
29
+ image
30
+ ]
31
+ outputs = [gallery]
32
+
33
+ submit_btn.click(infer, inputs, outputs)
34
+
35
+ demo.launch().queue()