Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import librosa
|
|
| 5 |
import soundfile as sf
|
| 6 |
import os
|
| 7 |
import zipfile
|
| 8 |
-
from huggingface_hub import HfApi, HfFolder, Repository
|
| 9 |
|
| 10 |
# Function to download audio from YouTube and save it as a WAV file
|
| 11 |
def download_youtube_audio(url, audio_name):
|
|
@@ -176,6 +176,17 @@ def process_audio(url, audio_name, hf_token, repo_id):
|
|
| 176 |
upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)
|
| 177 |
return zip_file, upload_message
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
with gr.Blocks() as demo:
|
| 180 |
with gr.Tabs():
|
| 181 |
with gr.TabItem("make dataset"):
|
|
|
|
| 5 |
import soundfile as sf
|
| 6 |
import os
|
| 7 |
import zipfile
|
| 8 |
+
from huggingface_hub import HfApi, HfFolder, Repository, create_repo
|
| 9 |
|
| 10 |
# Function to download audio from YouTube and save it as a WAV file
|
| 11 |
def download_youtube_audio(url, audio_name):
|
|
|
|
| 176 |
upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)
|
| 177 |
return zip_file, upload_message
|
| 178 |
|
| 179 |
+
|
| 180 |
+
# create new repository (optional)
|
| 181 |
+
def create_new_repo(repoid):
|
| 182 |
+
try:
|
| 183 |
+
create_repo(repoid)
|
| 184 |
+
return f"Repo '{repoid}' created successfully!"
|
| 185 |
+
except Exception as e:
|
| 186 |
+
return str(e)
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
with gr.Blocks() as demo:
|
| 191 |
with gr.Tabs():
|
| 192 |
with gr.TabItem("make dataset"):
|