irena commited on
Commit
b28a0c9
·
1 Parent(s): b983ced

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -16
app.py CHANGED
@@ -13,6 +13,13 @@ def transcribe_video(url):
13
  def transcribe_audio(audio):
14
  text = pipe(audio)["text"]
15
  return text
 
 
 
 
 
 
 
16
 
17
 
18
 
@@ -24,7 +31,18 @@ audio = gr.Interface(
24
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
25
  )
26
 
27
-
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  video = gr.Interface(
30
  fn=transcribe_video,
@@ -37,20 +55,7 @@ video = gr.Interface(
37
 
38
 
39
 
40
- demo = gr.TabbedInterface([audio, video], ["transcribe from recording", "transcribe from youtube url"])
41
 
42
  if __name__ == "__main__":
43
- demo.launch()
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
 
13
  def transcribe_audio(audio):
14
  text = pipe(audio)["text"]
15
  return text
16
+ def transcribe_file(audio):
17
+ text = pipe(audio)["text"]
18
+ return text
19
+
20
+
21
+
22
+
23
 
24
 
25
 
 
31
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
32
  )
33
 
34
+ file = gr.Interface(
35
+ fn=transcribe_file,
36
+ inputs=[
37
+ gr.inputs.Audio(source="upload", type="filepath", optional=True),
38
+ ],
39
+ outputs="text",
40
+ title="Whisper Small Swedish",
41
+ description=(
42
+ "Transcribe swedish audios"
43
+ )
44
+
45
+ )
46
 
47
  video = gr.Interface(
48
  fn=transcribe_video,
 
55
 
56
 
57
 
58
+ demo = gr.TabbedInterface([audio, file, video], ["transcribe from microphone", "transcribe from local audios", "transcribe from youtube url"])
59
 
60
  if __name__ == "__main__":
61
+ demo.launch()