Update audio.py
Browse files
audio.py
CHANGED
@@ -4,11 +4,15 @@ from elevenlabs import voices, generate, set_api_key, UnauthenticatedRateLimitEr
|
|
4 |
import huggingface_hub
|
5 |
from huggingface_hub import Repository
|
6 |
import os
|
|
|
|
|
|
|
7 |
|
8 |
DATASET_REPO_URL = "https://huggingface.co/datasets/laxsvips/audiofiles"
|
9 |
DATA_FILENAME = "audio.mp4"
|
10 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
11 |
DATASET_REPO_ID = "audiofiles/audio.mp4"
|
|
|
12 |
|
13 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
14 |
# repo = Repository(
|
@@ -31,7 +35,7 @@ def generate_voice(text):
|
|
31 |
model="eleven_monolingual_v1"
|
32 |
)
|
33 |
save(audio,'data/audio.mp4')
|
34 |
-
commit_url = upload_file(
|
35 |
DATA_FILE,
|
36 |
path_in_repo=DATA_FILENAME,
|
37 |
repo_id=DATASET_REPO_ID,
|
|
|
4 |
import huggingface_hub
|
5 |
from huggingface_hub import Repository
|
6 |
import os
|
7 |
+
from huggingface_hub import HfApi
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
|
11 |
DATASET_REPO_URL = "https://huggingface.co/datasets/laxsvips/audiofiles"
|
12 |
DATA_FILENAME = "audio.mp4"
|
13 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
14 |
DATASET_REPO_ID = "audiofiles/audio.mp4"
|
15 |
+
api = HfApi()
|
16 |
|
17 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
18 |
# repo = Repository(
|
|
|
35 |
model="eleven_monolingual_v1"
|
36 |
)
|
37 |
save(audio,'data/audio.mp4')
|
38 |
+
commit_url = api.upload_file(
|
39 |
DATA_FILE,
|
40 |
path_in_repo=DATA_FILENAME,
|
41 |
repo_id=DATASET_REPO_ID,
|