gradio/demo/examples_component/run.py
Ali Abdalla 02c7bfe1ed
Adding missing embedded components on docs (#3027)
* add embedded component for dataset

* add embedded component for examples

* add embedded component for progress

* remove make_waveform

* add embedded component for uploadbutton

* remove footer on lineplot embedded component

* remove broken image from gallery

* add embedded component for interpretation

* generated notebooks

* changelog

* change example component demo to images

* remove natgeo img in gallery demo

* regenerate notebooks
2023-01-24 13:15:06 -08:00

29 lines
750 B
Python

import gradio as gr
import os
def flip(i):
return i.rotate(180)
css = "footer {display: none !important;} .gradio-container {min-height: 0px !important;}"
with gr.Blocks(css=css) as demo:
with gr.Row():
with gr.Column():
img_i = gr.Image(label="Input Image", type="pil")
with gr.Column():
img_o = gr.Image(label="Output Image")
with gr.Row():
btn = gr.Button(value="Flip Image")
btn.click(flip, inputs=[img_i], outputs=[img_o])
gr.Examples(
[
os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
],
img_i,
img_o,
flip
)
demo.launch()