Update audio.py
Browse files
audio.py
CHANGED
@@ -2,7 +2,7 @@ import random
|
|
2 |
import numpy as np
|
3 |
from elevenlabs import voices, generate, set_api_key, UnauthenticatedRateLimitError, save
|
4 |
import huggingface_hub
|
5 |
-
from huggingface_hub import Repository
|
6 |
import os
|
7 |
from huggingface_hub import HfApi
|
8 |
import gradio as gr
|
@@ -40,12 +40,16 @@ def generate_voice(text):
|
|
40 |
save(audio,'data/audio.mp3')
|
41 |
# save(audio,'audio.wav')
|
42 |
# commit_url = repo.push_to_hub()
|
43 |
-
dataset = load_dataset("audiofolder", data_dir="./data")
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
return (return_url)
|
49 |
# return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
|
50 |
except UnauthenticatedRateLimitError as e:
|
51 |
raise gr.Error("Thanks for trying out ElevenLabs TTS! You've reached the free tier limit. Please provide an API key to continue.")
|
|
|
2 |
import numpy as np
|
3 |
from elevenlabs import voices, generate, set_api_key, UnauthenticatedRateLimitError, save
|
4 |
import huggingface_hub
|
5 |
+
from huggingface_hub import Repository, Dataset
|
6 |
import os
|
7 |
from huggingface_hub import HfApi
|
8 |
import gradio as gr
|
|
|
40 |
save(audio,'data/audio.mp3')
|
41 |
# save(audio,'audio.wav')
|
42 |
# commit_url = repo.push_to_hub()
|
43 |
+
# dataset = load_dataset("audiofolder", data_dir="./data")
|
44 |
+
audio_dataset = Dataset.from_dict({"audio": ["data/audio.mp3"]}).cast_column("audio", Audio())
|
45 |
+
commit_url = audio_dataset.push_to_hub("laxsvips/audiofiles")
|
46 |
+
|
47 |
+
return commit_url
|
48 |
+
# return_url = "failure"
|
49 |
+
# if commit_url:
|
50 |
+
# return_url = DATASET_REPO_URL+"/"+ DATA_FILENAME
|
51 |
|
52 |
+
# return (return_url)
|
53 |
# return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
|
54 |
except UnauthenticatedRateLimitError as e:
|
55 |
raise gr.Error("Thanks for trying out ElevenLabs TTS! You've reached the free tier limit. Please provide an API key to continue.")
|