import gradio as gr | |
def update(img): | |
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() |