File size: 696 Bytes
db12400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr

pix2pix = gr.Blocks.load(name="spaces/patrickvonplaten/instruct-pix2pix")

def infer(prompt,image):
    result = pix2pix(prompt,
        5.5,
        1.5,
        image,
        15,
        "",
        512,
        512,
        0,
        fn_index=0)

    print(result)
    return result[0]

with gr.Block() as demo:
    with gr.Column():
        prompt = gr.Textbox(placeholder="enter prompt")
        image = gr.Image(source="upload", type="filepath")
        gallery_out = gr.Gallery()
        submit_btn = gr.Button("go")

    inputs = [
        prompt,
        image
    ]
    outputs = [gallery]
    
    submit_btn.click(infer, inputs, outputs)

demo.launch().queue()