Spaces:
Runtime error
Runtime error
fix bug in app.py
Browse files
app.py
CHANGED
@@ -95,6 +95,10 @@ def inference(wav,lang):
|
|
95 |
speech, rate = soundfile.read(wav.name)
|
96 |
nbests = speech2text(speech)
|
97 |
text, *_ = nbests[0]
|
|
|
|
|
|
|
|
|
98 |
# if lang == "chinese":
|
99 |
# wav = text2speechch(text)["wav"]
|
100 |
# scipy.io.wavfile.write("out.wav",text2speechch.fs , wav.view(-1).cpu().numpy())
|
@@ -103,7 +107,7 @@ def inference(wav,lang):
|
|
103 |
# scipy.io.wavfile.write("out.wav",text2speechjp.fs , wav.view(-1).cpu().numpy())
|
104 |
return text
|
105 |
title = "ESPnet2-SLU"
|
106 |
-
description = "Gradio demo for ESPnet2-SLU:
|
107 |
article = "<p style='text-align: center'><a href='https://github.com/espnet/espnet' target='_blank'>Github Repo</a></p>"
|
108 |
|
109 |
examples=[['audio_slurp.flac',"english"]]
|
@@ -111,7 +115,7 @@ examples=[['audio_slurp.flac',"english"]]
|
|
111 |
# gr.inputs.Textbox(label="input text",lines=10),gr.inputs.Radio(choices=["english"], type="value", default="english", label="language")
|
112 |
gr.Interface(
|
113 |
inference,
|
114 |
-
[gr.inputs.Audio(label="input audio", type="file"),gr.inputs.Radio(choices=["english"], type="value", default="english", label="language")],
|
115 |
gr.outputs.Textbox(type="str", label="Output"),
|
116 |
title=title,
|
117 |
description=description,
|
|
|
95 |
speech, rate = soundfile.read(wav.name)
|
96 |
nbests = speech2text(speech)
|
97 |
text, *_ = nbests[0]
|
98 |
+
intent=text.split(" ")[0]
|
99 |
+
scenario=intent.split("_")[0]
|
100 |
+
action=intent.split("_")[1]
|
101 |
+
text="{scenario: "+scenario+", action: "+action"}"
|
102 |
# if lang == "chinese":
|
103 |
# wav = text2speechch(text)["wav"]
|
104 |
# scipy.io.wavfile.write("out.wav",text2speechch.fs , wav.view(-1).cpu().numpy())
|
|
|
107 |
# scipy.io.wavfile.write("out.wav",text2speechjp.fs , wav.view(-1).cpu().numpy())
|
108 |
return text
|
109 |
title = "ESPnet2-SLU"
|
110 |
+
description = "Gradio demo for ESPnet2-SLU: Advancing Spoken Language Understanding through ESPnet. To use it, simply record your audio. Read more at the links below."
|
111 |
article = "<p style='text-align: center'><a href='https://github.com/espnet/espnet' target='_blank'>Github Repo</a></p>"
|
112 |
|
113 |
examples=[['audio_slurp.flac',"english"]]
|
|
|
115 |
# gr.inputs.Textbox(label="input text",lines=10),gr.inputs.Radio(choices=["english"], type="value", default="english", label="language")
|
116 |
gr.Interface(
|
117 |
inference,
|
118 |
+
[gr.inputs.Audio(label="input audio",source = "microphone", type="file"),gr.inputs.Radio(choices=["english"], type="value", default="english", label="language")],
|
119 |
gr.outputs.Textbox(type="str", label="Output"),
|
120 |
title=title,
|
121 |
description=description,
|