cotxetj commited on
Commit
517eb68
1 Parent(s): 15948f3

Update app.py

Browse files

adding example for each translation

Files changed (1) hide show
  1. app.py +9 -4
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", source="upload", type="numpy"),
69
- gr.Audio(label="Record an audio", source="microphone", type="numpy"),
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