Spaces:
Running
Running
File size: 1,425 Bytes
5b0a718 d9eecfa cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 d9eecfa 5b0a718 cefa8e3 d9eecfa cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 d9eecfa 5b0a718 cefa8e3 d9eecfa 5b0a718 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import os
os.system('pip uninstall vidfetch -y')
os.system('pip install -U https://github.com/dailingx/VidFetch/archive/master.zip')
os.system('pip install --upgrade google-api-python-client')
import sys
import gradio as gr
from vidfetch.website.youtube import YoutubeVideoDataset
def fetch(
key_word: str,
dev_key: str,
hf_token: str,
hf_ds_repo_id: str
):
youtube_video_dataset = YoutubeVideoDataset(
root_dir="./",
google_cloud_developer_key=dev_key,
search_keyword=key_word,
video_max_num=1,
hf_token=hf_token,
hf_ds_repo_id=hf_ds_repo_id
)
youtube_video_dataset.download()
return key_word
with gr.Blocks() as demo:
gr.Markdown('''OpenVideo Youtube fetch demo''')
with gr.Row():
with gr.Column():
kw_input_text = gr.Text(label='Keyword')
dev_key_input_text = gr.Text(label='Google Cloud Developer Key')
hf_token_input_text = gr.Text(label='HF Token')
hf_ds_repo_id_text = gr.Text(label='HF Dataset Repo ID, like: OpenVideo/YouTube-Commons-5G-Raw')
fetch_btn = gr.Button("Fetch")
result = gr.Text()
fetch_btn.click(fn=fetch, inputs=[kw_input_text, dev_key_input_text, hf_token_input_text, hf_ds_repo_id_text],
outputs=[result])
if __name__ == "__main__":
demo.queue(max_size=1)
demo.launch(share=False, max_threads=1)
|