import gradio as gr import os def load_and_display_video(video_path): if os.path.exists(video_path): return video_path else: return "Invalid video path." with gr.Blocks() as demo: video_input = gr.Textbox(label="Enter Video Path") video_output = gr.Video(label="Video Output") load_button = gr.Button("Load Video") load_button.click(fn=load_and_display_video, inputs=video_input, outputs=video_output) # 启动应用 demo.launch()