Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadding example for each translation
app.py
CHANGED
@@ -56,17 +56,22 @@ def predict(transType, language, audio, audio_mic = None):
|
|
56 |
title = "Swedish STSOT (Speech To Speech Or Text)"
|
57 |
description="Use Whisper pretrained model to convert swedish audio to english (text or audio)"
|
58 |
|
59 |
-
demo = gr.Blocks()
|
60 |
|
61 |
supportLangs = ["Swedish", "French (in training)"]
|
62 |
transTypes = ["Text", "Audio"]
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
demo = gr.Interface(
|
64 |
fn=predict,
|
65 |
inputs=[
|
66 |
gr.Radio(label="Choose your output format", choices=transTypes),
|
67 |
gr.Radio(label="Choose a source language", choices=supportLangs, value="Swedish"),
|
68 |
-
gr.Audio(label="Import an audio",
|
69 |
-
gr.Audio(label="Record an audio",
|
70 |
],
|
71 |
outputs=[
|
72 |
gr.Text(label="Translation"),
|
@@ -74,7 +79,7 @@ demo = gr.Interface(
|
|
74 |
title=title,
|
75 |
description=description,
|
76 |
article="",
|
77 |
-
examples=
|
78 |
).launch()
|
79 |
|
80 |
|
|
|
56 |
title = "Swedish STSOT (Speech To Speech Or Text)"
|
57 |
description="Use Whisper pretrained model to convert swedish audio to english (text or audio)"
|
58 |
|
|
|
59 |
|
60 |
supportLangs = ["Swedish", "French (in training)"]
|
61 |
transTypes = ["Text", "Audio"]
|
62 |
+
|
63 |
+
examples = [
|
64 |
+
["Text", "Swedish", "ex1.mp3", None],
|
65 |
+
["Audio", "Swedish", "ex2.mp3", None]
|
66 |
+
]
|
67 |
+
|
68 |
demo = gr.Interface(
|
69 |
fn=predict,
|
70 |
inputs=[
|
71 |
gr.Radio(label="Choose your output format", choices=transTypes),
|
72 |
gr.Radio(label="Choose a source language", choices=supportLangs, value="Swedish"),
|
73 |
+
gr.Audio(label="Import an audio", sources="upload", type="numpy"),
|
74 |
+
gr.Audio(label="Record an audio", sources="microphone", type="numpy"),
|
75 |
],
|
76 |
outputs=[
|
77 |
gr.Text(label="Translation"),
|
|
|
79 |
title=title,
|
80 |
description=description,
|
81 |
article="",
|
82 |
+
examples=examples,
|
83 |
).launch()
|
84 |
|
85 |
|