Rodrigo_Cobo commited on
Commit
e32d51c
1 Parent(s): 1ec4691

change output to image

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,12 +1,15 @@
1
  import gradio as gr
2
- def update(name):
3
- return f"Welcome to Gradio !"
 
 
 
4
 
5
  with gr.Blocks() as demo:
6
  gr.Markdown("Start typing below and then click **Run** to see the output.")
7
  with gr.Row():
8
- inp = gr.Image()
9
- out = gr.Textbox()
10
  btn = gr.Button("Run")
11
  btn.click(fn=update, inputs=inp, outputs=out)
12
 
 
1
  import gradio as gr
2
+ def update(img):
3
+
4
+ img.save("temp/image.jpg", "JPEG")
5
+
6
+ return f'temp/image.jpg'
7
 
8
  with gr.Blocks() as demo:
9
  gr.Markdown("Start typing below and then click **Run** to see the output.")
10
  with gr.Row():
11
+ inp = gr.Image(type="pil", label="Input")
12
+ out = gr.Image(type="file", label="Output")
13
  btn = gr.Button("Run")
14
  btn.click(fn=update, inputs=inp, outputs=out)
15