Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
g2p = pipeline("translation", model="B-K/umt5-thai-g2p-v2-0.5k")
|
6 |
|
7 |
|
8 |
def respond(
|
9 |
-
|
10 |
target
|
11 |
):
|
12 |
target_phoneme = g2p(target)[0]["translation_text"].replace(" ", "")
|
13 |
-
|
|
|
|
|
14 |
|
15 |
|
16 |
"""
|
@@ -19,6 +21,7 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
|
|
19 |
demo = gr.Interface(
|
20 |
respond,
|
21 |
inputs=[
|
|
|
22 |
gr.Textbox(label="target")
|
23 |
],
|
24 |
outputs="text"
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
asr = pipeline("automatic-speech-recognition", model="B-K/ReVoiceAI-W2V-BERT-Thai-IPA")
|
5 |
g2p = pipeline("translation", model="B-K/umt5-thai-g2p-v2-0.5k")
|
6 |
|
7 |
|
8 |
def respond(
|
9 |
+
audio,
|
10 |
target
|
11 |
):
|
12 |
target_phoneme = g2p(target)[0]["translation_text"].replace(" ", "")
|
13 |
+
|
14 |
+
input_phoneme = asr(audio)[0]["text"]
|
15 |
+
return [target_phoneme, input_phoneme]
|
16 |
|
17 |
|
18 |
"""
|
|
|
21 |
demo = gr.Interface(
|
22 |
respond,
|
23 |
inputs=[
|
24 |
+
gr.Audio(lable="speak", wavform_options=gradio.WaveformOptions(sample_rate=16000)),
|
25 |
gr.Textbox(label="target")
|
26 |
],
|
27 |
outputs="text"
|