Spaces:
Sleeping
Sleeping
import os | |
os.system('pip uninstall vidfetch') | |
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 | |
): | |
youtube_video_dataset = YoutubeVideoDataset( | |
root_dir="./", | |
google_cloud_developer_key=dev_key, | |
search_keyword=key_word, | |
video_max_num=1 | |
) | |
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') | |
fetch_btn = gr.Button("Fetch") | |
result = gr.Text() | |
fetch_btn.click(fn=fetch, inputs=[kw_input_text, dev_key_input_text], outputs=[result]) | |
if __name__ == "__main__": | |
demo.queue(max_size=1) | |
demo.launch(share=False, max_threads=1) | |