tttarun commited on
Commit
b808ab6
1 Parent(s): f185e86

Update audio_save.py

Browse files
Files changed (1) hide show
  1. audio_save.py +10 -6
audio_save.py CHANGED
@@ -8,11 +8,15 @@ if not os.path.exists('./tarun_1234'):
8
 
9
  hf_token = os.environ['HF_TOKEN']
10
 
 
 
11
  @app.post("/save_audio")
12
- async def save_audio(audio: UploadFile = File(...), path: str = Form(...)):
13
 
14
  # print('PATH ************************ >>>>>', path)
15
  folder_path = path.split('/')[1]
 
 
16
 
17
  count = path.split('/')[-1].split('.')[0]
18
 
@@ -52,11 +56,11 @@ async def save_audio(audio: UploadFile = File(...), path: str = Form(...)):
52
  # df1 = pd.DataFrame(l,columns = ['script','response','transcription'])
53
 
54
 
55
- # api.upload_file(
56
- # path_or_fileobj=f'{folder_path}/transcription/{folder_path}.csv',
57
- # path_in_repo=f"{folder_path}.csv",
58
- # repo_id="hellojarvis/agent_test",
59
- # repo_type="dataset",)
60
 
61
  # api.upload_file(
62
  # path_or_fileobj=f'{folder_path}/transcription/state_wise_duplicates.csv',
 
8
 
9
  hf_token = os.environ['HF_TOKEN']
10
 
11
+ api = HfApi(token = hf_token)
12
+
13
  @app.post("/save_audio")
14
+ async def save_audio(audio: UploadFile = File(...), path: str = Form(...), script_name: str = Form(...)):
15
 
16
  # print('PATH ************************ >>>>>', path)
17
  folder_path = path.split('/')[1]
18
+ filename = path.split('/')[-1]
19
+ # script_name = script_name
20
 
21
  count = path.split('/')[-1].split('.')[0]
22
 
 
56
  # df1 = pd.DataFrame(l,columns = ['script','response','transcription'])
57
 
58
 
59
+ api.upload_file(
60
+ path_or_fileobj=path,
61
+ path_in_repo=f"{folder_path}/{script_name}/{filename}",
62
+ repo_id="hellojarvis/agent_data",
63
+ repo_type="dataset",)
64
 
65
  # api.upload_file(
66
  # path_or_fileobj=f'{folder_path}/transcription/state_wise_duplicates.csv',