Update audio.py
Browse files
audio.py
CHANGED
@@ -9,10 +9,10 @@ DATASET_REPO_URL = "https://huggingface.co/datasets/laxsvips/audiofiles"
|
|
9 |
DATA_FILENAME = "audio.mp4"
|
10 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
def pad_buffer(audio):
|
18 |
# Pad buffer to multiple of 2 bytes
|
@@ -29,8 +29,10 @@ def generate_voice(text):
|
|
29 |
voice="Arnold",
|
30 |
model="eleven_monolingual_v1"
|
31 |
)
|
32 |
-
save(audio,'data/audio.mp4')
|
33 |
-
|
|
|
|
|
34 |
except UnauthenticatedRateLimitError as e:
|
35 |
raise gr.Error("Thanks for trying out ElevenLabs TTS! You've reached the free tier limit. Please provide an API key to continue.")
|
36 |
except Exception as e:
|
|
|
9 |
DATA_FILENAME = "audio.mp4"
|
10 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
11 |
|
12 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
13 |
+
repo = Repository(
|
14 |
+
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
15 |
+
)
|
16 |
|
17 |
def pad_buffer(audio):
|
18 |
# Pad buffer to multiple of 2 bytes
|
|
|
29 |
voice="Arnold",
|
30 |
model="eleven_monolingual_v1"
|
31 |
)
|
32 |
+
save(audio,'data/audio.mp4')
|
33 |
+
commit_url = repo.push_to_hub()
|
34 |
+
return (commit_url)
|
35 |
+
# return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
|
36 |
except UnauthenticatedRateLimitError as e:
|
37 |
raise gr.Error("Thanks for trying out ElevenLabs TTS! You've reached the free tier limit. Please provide an API key to continue.")
|
38 |
except Exception as e:
|