Spaces:
Running
on
A10G
Running
on
A10G
Create app.py
Browse files
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()
|