smjain commited on
Commit
0d425b8
1 Parent(s): 8850937

Upload testhandler.py

Browse files
Files changed (1) hide show
  1. testhandler.py +33 -0
testhandler.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import os
3
+ import traceback
4
+ import sys
5
+ import warnings
6
+ import shutil
7
+ import numpy as np
8
+ import infer_new
9
+
10
+ def main():
11
+ try:
12
+ print("Inside main function ********")
13
+
14
+ # Setup your parameters here
15
+
16
+ spk_id = "modi.pth"
17
+ voice_transform = 0
18
+ input_audio_path = "test.mp3"
19
+
20
+ # Call the api_convert_voice function from infer_new.py
21
+ # Ensure that infer_new.py is correctly implemented to handle this function call
22
+ output_path = infer_new.api_convert_voice(spk_id, voice_transform, input_audio_path)
23
+ print(f"Processed audio file is located at: {output_path}")
24
+
25
+ # Depending on your needs, you can return or print any results here
26
+ print(f"Hello, ! The processed audio file is located at: {output_path}")
27
+
28
+ except Exception as e:
29
+ print("An error occurred:", e)
30
+ traceback.print_exc()
31
+
32
+ if __name__ == "__main__":
33
+ main()