Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 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 |
|
|
@@ -10,13 +10,17 @@ from vidfetch.website.youtube import YoutubeVideoDataset
|
|
| 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
|
|
@@ -28,10 +32,13 @@ with gr.Blocks() as demo:
|
|
| 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
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import os
|
| 2 |
+
os.system('pip uninstall vidfetch -y')
|
| 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 |
|
|
|
|
| 10 |
|
| 11 |
def fetch(
|
| 12 |
key_word: str,
|
| 13 |
+
dev_key: str,
|
| 14 |
+
hf_token: str,
|
| 15 |
+
hf_ds_repo_id: str
|
| 16 |
):
|
| 17 |
youtube_video_dataset = YoutubeVideoDataset(
|
| 18 |
root_dir="./",
|
| 19 |
google_cloud_developer_key=dev_key,
|
| 20 |
search_keyword=key_word,
|
| 21 |
+
video_max_num=1,
|
| 22 |
+
hf_token=hf_token,
|
| 23 |
+
hf_ds_repo_id=hf_ds_repo_id
|
| 24 |
)
|
| 25 |
youtube_video_dataset.download()
|
| 26 |
return key_word
|
|
|
|
| 32 |
with gr.Column():
|
| 33 |
kw_input_text = gr.Text(label='Keyword')
|
| 34 |
dev_key_input_text = gr.Text(label='Google Cloud Developer Key')
|
| 35 |
+
hf_token_input_text = gr.Text(label='HF Token')
|
| 36 |
+
hf_ds_repo_id_text = gr.Text(label='HF Dataset Repo ID, like: OpenVideo/YouTube-Commons-5G-Raw')
|
| 37 |
fetch_btn = gr.Button("Fetch")
|
| 38 |
result = gr.Text()
|
| 39 |
|
| 40 |
+
fetch_btn.click(fn=fetch, inputs=[kw_input_text, dev_key_input_text, hf_token_input_text, hf_ds_repo_id_text],
|
| 41 |
+
outputs=[result])
|
| 42 |
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|