Spaces:
Running
Running
import numpy as np | |
import gradio as gr | |
def flip_text(x): | |
return x[::-1] | |
def flip_image(x): | |
return np.fliplr(x) | |
with gr.Blocks() as demo: | |
gr.Markdown("Flip image or video files using this demo.") | |
with gr.Tabs(): | |
with gr.TabItem("Flip Image"): | |
with gr.Row(): | |
image_input = gr.Image() | |
image_output = gr.Image() | |
image_button = gr.Button("Flip") | |
with gr.TabItem("Flip Video"): | |
video_input = gr.Video() | |
video_output = gr.Video() | |
video_button = gr.Button("Flip") | |
image_button.click(flip_image, inputs=image_input, outputs=image_output) | |
video_button.click(flip_text, inputs=video_input, outputs=video_output) | |
demo.launch() | |
# 启动接口 | |
#demo.launch(server_name='127.0.0.1',server_port=7788) | |