test3 / app.py
juziguaijiu's picture
Update app.py
10ebac9 verified
raw
history blame contribute delete
708 Bytes
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()