mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
02c7bfe1ed
* 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
29 lines
750 B
Python
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() |