File size: 523 Bytes
44925e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()