laxsvips commited on
Commit
6b035eb
·
1 Parent(s): 54b7e81

Update audio.py

Browse files
Files changed (1) hide show
  1. audio.py +13 -6
audio.py CHANGED
@@ -7,12 +7,13 @@ 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
 
12
  HF_TOKEN = os.environ.get("HF_TOKEN")
13
- repo = Repository(
14
- 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,8 +30,14 @@ def generate_voice(text):
29
  voice="Arnold",
30
  model="eleven_monolingual_v1"
31
  )
32
- save(audio,'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:
 
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(
15
+ # clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
16
+ # )
17
 
18
  def pad_buffer(audio):
19
  # Pad buffer to multiple of 2 bytes
 
30
  voice="Arnold",
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,
38
+ token=HF_TOKEN,
39
+ repo_type="dataset"
40
+ )
41
  return (commit_url)
42
  # return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
43
  except UnauthenticatedRateLimitError as e: