Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -54,51 +54,51 @@ async def predict(
|
|
54 |
----------
|
55 |
file : bytes
|
56 |
input audio file
|
57 |
-
|
58 |
word : strings
|
59 |
true hiragana word to calculate word score
|
60 |
-
|
61 |
pitch : strings
|
62 |
true pitch to calculate pitch score
|
63 |
-
|
64 |
temperature: integer
|
65 |
the difficulty of AI model
|
66 |
-
|
67 |
Returns:
|
68 |
-------
|
69 |
timestamp: strings
|
70 |
current time Year-Month-Day-Hours:Minutes:Second
|
71 |
-
|
72 |
running_time : strings
|
73 |
running time second
|
74 |
-
|
75 |
error message : strings
|
76 |
error message from api
|
77 |
-
|
78 |
audio duration: integer
|
79 |
durations of source audio
|
80 |
-
|
81 |
target : integer
|
82 |
durations of target audio
|
83 |
-
|
84 |
method : string
|
85 |
method applied to transform source audio
|
86 |
-
|
87 |
word predict : strings
|
88 |
text from api
|
89 |
-
|
90 |
pitch predict : strings
|
91 |
pitch from api
|
92 |
-
|
93 |
wrong word index: strings (ex: 100)
|
94 |
wrong word compare to target word
|
95 |
-
|
96 |
wrong pitch index: strings (ex: 100)
|
97 |
wrong word compare to target word
|
98 |
-
|
99 |
score: integer
|
100 |
Levenshtein Distance Score from pitch and word
|
101 |
-
|
102 |
"""
|
103 |
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
104 |
audio_duration = len(upload_audio) / 16000
|
@@ -135,7 +135,7 @@ async def predict(
|
|
135 |
score = int(word_score)
|
136 |
best_pitch_predict = None
|
137 |
wrong_pitch = None
|
138 |
-
|
139 |
return {"timestamp": current_time,
|
140 |
"running_time": f"{round(time.time() - start_time, 4)} s",
|
141 |
"error message": error_message,
|
|
|
54 |
----------
|
55 |
file : bytes
|
56 |
input audio file
|
57 |
+
|
58 |
word : strings
|
59 |
true hiragana word to calculate word score
|
60 |
+
|
61 |
pitch : strings
|
62 |
true pitch to calculate pitch score
|
63 |
+
|
64 |
temperature: integer
|
65 |
the difficulty of AI model
|
66 |
+
|
67 |
Returns:
|
68 |
-------
|
69 |
timestamp: strings
|
70 |
current time Year-Month-Day-Hours:Minutes:Second
|
71 |
+
|
72 |
running_time : strings
|
73 |
running time second
|
74 |
+
|
75 |
error message : strings
|
76 |
error message from api
|
77 |
+
|
78 |
audio duration: integer
|
79 |
durations of source audio
|
80 |
+
|
81 |
target : integer
|
82 |
durations of target audio
|
83 |
+
|
84 |
method : string
|
85 |
method applied to transform source audio
|
86 |
+
|
87 |
word predict : strings
|
88 |
text from api
|
89 |
+
|
90 |
pitch predict : strings
|
91 |
pitch from api
|
92 |
+
|
93 |
wrong word index: strings (ex: 100)
|
94 |
wrong word compare to target word
|
95 |
+
|
96 |
wrong pitch index: strings (ex: 100)
|
97 |
wrong word compare to target word
|
98 |
+
|
99 |
score: integer
|
100 |
Levenshtein Distance Score from pitch and word
|
101 |
+
|
102 |
"""
|
103 |
upload_audio = ffmpeg_read(file, sampling_rate=16000)
|
104 |
audio_duration = len(upload_audio) / 16000
|
|
|
135 |
score = int(word_score)
|
136 |
best_pitch_predict = None
|
137 |
wrong_pitch = None
|
138 |
+
|
139 |
return {"timestamp": current_time,
|
140 |
"running_time": f"{round(time.time() - start_time, 4)} s",
|
141 |
"error message": error_message,
|