Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -3,6 +3,7 @@ import datetime
|
|
3 |
import time
|
4 |
import torch
|
5 |
import os
|
|
|
6 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC, Wav2Vec2ProcessorWithLM, AutoConfig
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
from fuzzywuzzy import fuzz
|
@@ -101,6 +102,9 @@ async def predict(
|
|
101 |
|
102 |
"""
|
103 |
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
|
|
|
|
|
|
104 |
audio_duration = len(upload_audio) / 16000
|
105 |
current_time = datetime.datetime.now().strftime("%Y-%h-%d-%H:%M:%S")
|
106 |
start_time = time.time()
|
@@ -144,5 +148,6 @@ async def predict(
|
|
144 |
"pitch predict": best_pitch_predict,
|
145 |
"wrong word index": wrong_word,
|
146 |
"wrong pitch index": wrong_pitch,
|
147 |
-
"score": score
|
|
|
148 |
}
|
|
|
3 |
import time
|
4 |
import torch
|
5 |
import os
|
6 |
+
import numpy as np
|
7 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC, Wav2Vec2ProcessorWithLM, AutoConfig
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
from fuzzywuzzy import fuzz
|
|
|
102 |
|
103 |
"""
|
104 |
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
105 |
+
print(upload_audio.shape)
|
106 |
+
print(np.sum(np.abs(upload_audio)))
|
107 |
+
debug = np.sum(np.abs(upload_audio))
|
108 |
audio_duration = len(upload_audio) / 16000
|
109 |
current_time = datetime.datetime.now().strftime("%Y-%h-%d-%H:%M:%S")
|
110 |
start_time = time.time()
|
|
|
148 |
"pitch predict": best_pitch_predict,
|
149 |
"wrong word index": wrong_word,
|
150 |
"wrong pitch index": wrong_pitch,
|
151 |
+
"score": score,
|
152 |
+
"debug": debug,
|
153 |
}
|