Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,37 @@
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
2 |
import sys
|
3 |
import gradio as gr
|
|
|
4 |
|
5 |
|
6 |
def fetch(
|
7 |
-
key_word: str
|
|
|
8 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
return key_word
|
10 |
-
|
11 |
|
12 |
with gr.Blocks() as demo:
|
13 |
gr.Markdown('''OpenVideo Youtube fetch demo''')
|
14 |
with gr.Row():
|
15 |
with gr.Column():
|
16 |
kw_input_text = gr.Text(label='Keyword')
|
|
|
17 |
fetch_btn = gr.Button("Fetch")
|
18 |
result = gr.Text()
|
19 |
-
|
20 |
-
fetch_btn.click(fn=fetch, inputs=[kw_input_text], outputs=[result])
|
21 |
|
22 |
|
23 |
if __name__ == "__main__":
|
|
|
1 |
import os
|
2 |
+
os.system('pip uninstall vidfetch')
|
3 |
+
os.system('pip install -U https://github.com/dailingx/VidFetch/archive/master.zip')
|
4 |
+
os.system('pip install --upgrade google-api-python-client')
|
5 |
+
|
6 |
import sys
|
7 |
import gradio as gr
|
8 |
+
from vidfetch.website.youtube import YoutubeVideoDataset
|
9 |
|
10 |
|
11 |
def fetch(
|
12 |
+
key_word: str,
|
13 |
+
dev_key: str
|
14 |
):
|
15 |
+
youtube_video_dataset = YoutubeVideoDataset(
|
16 |
+
root_dir="./",
|
17 |
+
google_cloud_developer_key=dev_key,
|
18 |
+
search_keyword=key_word,
|
19 |
+
video_max_num=1
|
20 |
+
)
|
21 |
+
youtube_video_dataset.download()
|
22 |
return key_word
|
23 |
+
|
24 |
|
25 |
with gr.Blocks() as demo:
|
26 |
gr.Markdown('''OpenVideo Youtube fetch demo''')
|
27 |
with gr.Row():
|
28 |
with gr.Column():
|
29 |
kw_input_text = gr.Text(label='Keyword')
|
30 |
+
dev_key_input_text = gr.Text(label='Google Cloud Developer Key')
|
31 |
fetch_btn = gr.Button("Fetch")
|
32 |
result = gr.Text()
|
33 |
+
|
34 |
+
fetch_btn.click(fn=fetch, inputs=[kw_input_text, dev_key_input_text], outputs=[result])
|
35 |
|
36 |
|
37 |
if __name__ == "__main__":
|