File size: 708 Bytes
15ec6b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from datasets import load_dataset

# 加载数据集
ds = load_dataset("OpenVideo/sample-200")

def show_sample(index):
    # 从数据集中获取样本
    sample = ds['train'][index]
    # 假设样本包含视频的URL和描述
    video_url = sample.get('video_url', 'No URL available')
    description = sample.get('description', 'No description available')
    return video_url, description

# 使用Gradio创建界面
iface = gr.Interface(
    fn=show_sample,
    inputs=gr.inputs.Slider(0, len(ds['train']) - 1, step=1, default=0, label="Sample Index"),
    outputs=[gr.outputs.Textbox(label="Video URL"), gr.outputs.Textbox(label="Description")]
)
# 运行界面
iface.launch()