Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -15,8 +15,8 @@ API_TOKEN = os.environ["API_TOKEN"]
|
|
15 |
MODEL_PATH = os.environ["MODEL_PATH"]
|
16 |
PITCH_PATH = os.environ["PITCH_PATH"]
|
17 |
|
18 |
-
|
19 |
-
|
20 |
|
21 |
|
22 |
## word preprocessor
|
@@ -102,10 +102,7 @@ async def predict(
|
|
102 |
Levenshtein Distance Score from pitch and word
|
103 |
|
104 |
"""
|
105 |
-
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
106 |
-
# print(upload_audio.shape)
|
107 |
-
# print(np.sum(np.abs(upload_audio)))
|
108 |
-
debug = np.sum(np.abs(upload_audio))
|
109 |
audio_duration = len(upload_audio) / 16000
|
110 |
current_time = datetime.datetime.now().strftime("%Y-%h-%d-%H:%M:%S")
|
111 |
start_time = time.time()
|
@@ -150,5 +147,4 @@ async def predict(
|
|
150 |
"wrong word index": wrong_word,
|
151 |
"wrong pitch index": wrong_pitch,
|
152 |
"score": score,
|
153 |
-
"debug": debug,
|
154 |
}
|
|
|
15 |
MODEL_PATH = os.environ["MODEL_PATH"]
|
16 |
PITCH_PATH = os.environ["PITCH_PATH"]
|
17 |
|
18 |
+
QUANTIZED_MODEL_PATH = hf_hub_download(repo_id=MODEL_PATH, filename='quantized_model.pt', token=API_TOKEN)
|
19 |
+
QUANTIZED_PITCH_MODEL_PATH = hf_hub_download(repo_id=PITCH_PATH, filename='quantized_model.pt', token=API_TOKEN)
|
20 |
|
21 |
|
22 |
## word preprocessor
|
|
|
102 |
Levenshtein Distance Score from pitch and word
|
103 |
|
104 |
"""
|
105 |
+
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
|
|
|
|
|
|
106 |
audio_duration = len(upload_audio) / 16000
|
107 |
current_time = datetime.datetime.now().strftime("%Y-%h-%d-%H:%M:%S")
|
108 |
start_time = time.time()
|
|
|
147 |
"wrong word index": wrong_word,
|
148 |
"wrong pitch index": wrong_pitch,
|
149 |
"score": score,
|
|
|
150 |
}
|