Spaces:
Runtime error
Runtime error
import gradio as gr | |
import numpy as np | |
def flip_text(text): | |
return text[::-1] | |
def flip_img(img): | |
return np.flipud(img) | |
with gr.Blocks() as demo: | |
gr.Markdown("flip the text or image using this demo") | |
with gr.Tab("Flip Text"): | |
text_input = gr.Textbox(); | |
text_output = gr.Textbox(); | |
text_btn = gr.Button("Flip"); | |
with gr.Tab("Flip Img"): | |
with gr.Row(): | |
image_input = gr.Image(source="webcam"); | |
image_outpt = gr.Image(); | |
image_btn = gr.Button("Flip"); | |
with gr.Accordion("Open for more"): | |
gr.Markdown("Look at me"); | |
text_btn.click(flip_text, inputs=text_input, outputs=text_output) | |
image_btn.click(flip_img, inputs=image_input, outputs=image_outpt) | |
demo.launch() |