File size: 503 Bytes
d8eaf88
23e9852
d8eaf88
e32d51c
 
d8eaf88
 
 
e32d51c
 
 
23e9852
cdcc96d
 
 
e32d51c
 
cdcc96d
 
23e9852
cdcc96d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import gradio as gr

def update(img):

    if not os.path.exists('temp'):
      os.system('mkdir temp')

    img.save("temp/image.jpg", "JPEG")

    return f'temp/image.jpg'

with gr.Blocks() as demo:
    gr.Markdown("Start typing below and then click **Run** to see the output.")
    with gr.Row():
        inp = gr.Image(type="pil", label="Input")
        out = gr.Image(type="file", label="Output")
    btn = gr.Button("Run")
    btn.click(fn=update, inputs=inp, outputs=out)

demo.launch()