laxsvips commited on
Commit
239228e
1 Parent(s): f465e5e

Update audio.py

Browse files
Files changed (1) hide show
  1. audio.py +16 -10
audio.py CHANGED
@@ -11,13 +11,17 @@ import gradio as gr
11
  DATASET_REPO_URL = "https://huggingface.co/datasets/laxsvips/audiofiles/audio.mp4"
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(
19
- # clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
20
- # )
 
 
21
 
22
  def pad_buffer(audio):
23
  # Pad buffer to multiple of 2 bytes
@@ -35,12 +39,14 @@ def generate_voice(text):
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,
42
- repo_type="dataset"
43
- )
 
 
44
  # api.upload_file(
45
  # folder_path="./data",
46
  # repo_id=DATASET_REPO_ID,
 
11
  DATASET_REPO_URL = "https://huggingface.co/datasets/laxsvips/audiofiles/audio.mp4"
12
  DATA_FILENAME = "audio.mp4"
13
  DATA_FILE = os.path.join("data", DATA_FILENAME)
14
+ # DATASET_REPO_ID = "audiofiles/audio.mp4"
15
+
16
+
17
  api = HfApi()
18
 
19
  HF_TOKEN = os.environ.get("HF_TOKEN")
20
+ repo = Repository(
21
+ local_dir="data",
22
+ clone_from=DATASET_REPO_URL,
23
+ use_auth_token=HF_TOKEN
24
+ )
25
 
26
  def pad_buffer(audio):
27
  # Pad buffer to multiple of 2 bytes
 
39
  model="eleven_monolingual_v1"
40
  )
41
  save(audio,'data/audio.mp4')
42
+ save(audio,'audio.mp4')
43
+ commit_url = repo.push_to_hub()
44
+ # commit_url = api.upload_file(
45
+ # DATA_FILE,
46
+ # path_in_repo=DATA_FILENAME,
47
+ # repo_id=DATASET_REPO_ID,
48
+ # repo_type="dataset"
49
+ # )
50
  # api.upload_file(
51
  # folder_path="./data",
52
  # repo_id=DATASET_REPO_ID,