File size: 1,015 Bytes
8aa6d79
53b8c3a
 
8aa6d79
 
e53dbad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from utils import encoder, decoder



demo = gr.Blocks()

with demo:
    with gr.Row():
        with gr.Column():
            source_img = gr.Image(source="upload", type="filepath", label="init_img")
            
            noise = gr.Slider(label='noise', minimum = 0.5, maximum = 1, step = .005, value = .95)
            with gr.Row():
                b1 = gr.Button("Encoder")
        with gr.Column():
            encoded_img = gr.Image()
            

            
    with gr.Row():
        with gr.Column():
            noise_img = gr.Image(source="upload", type="filepath", label="init_img")
            k = gr.Slider(label='k', minimum = 1, maximum = 10, step = 1, value = 1)
            with gr.Row():
                b2 = gr.Button("Decoder")
        with gr.Column():
                decoded_img = gr.Image()
            

    b1.click(encoder, inputs=[source_img, noise], outputs=encoded_img)
    b2.click(decoder, inputs=[noise_img,k], outputs=decoded_img)
    
    
demo.launch()