Spaces:
Sleeping
Sleeping
File size: 1,085 Bytes
5b0a718 cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 5b0a718 cefa8e3 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 |
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)
|