Spaces:
Running
Running
yuangongfdu
commited on
Commit
•
3b082be
1
Parent(s):
b396343
Update app.py
Browse files
app.py
CHANGED
@@ -24,15 +24,15 @@ def predict(audio_path, time_resolution):
|
|
24 |
audio_tag_result = whisper.parse_at_label(result, language='follow_asr', top_k=5, p_threshold=-1, include_class_list=list(range(527)))
|
25 |
# print(audio_tag_result)
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
asr_output, at_output = str(result["text"]), 'k'
|
36 |
return asr_output, at_output
|
37 |
|
38 |
iface = gr.Interface(fn=predict,
|
|
|
24 |
audio_tag_result = whisper.parse_at_label(result, language='follow_asr', top_k=5, p_threshold=-1, include_class_list=list(range(527)))
|
25 |
# print(audio_tag_result)
|
26 |
|
27 |
+
asr_output = ""
|
28 |
+
for segment in result['segments']:
|
29 |
+
asr_output = asr_output + str(segment['start']) + 's-' + str(segment['end']) + 's: ' + segment['text'] + '\n'
|
30 |
+
at_output = ""
|
31 |
+
for segment in audio_tag_result:
|
32 |
+
print(segment)
|
33 |
+
at_output = at_output + str(segment['time']['start']) + 's-' + str(segment['time']['end']) + 's: ' + ','.join([x[0] for x in segment['audio tags']]) + '\n'
|
34 |
+
print(at_output)
|
35 |
+
#asr_output, at_output = str(result["text"]), 'k'
|
36 |
return asr_output, at_output
|
37 |
|
38 |
iface = gr.Interface(fn=predict,
|