Vasi001 commited on
Commit
7014596
·
1 Parent(s): 1d821b4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ pipe = pipeline(model="rscolati/whisper-small-sv")
5
+
6
+
7
+ def transcribe(rec=None, file=None):
8
+ if rec is not None:
9
+ audio = rec
10
+ elif file is not None:
11
+ audio = file
12
+ else:
13
+ return "Provide a recording or a file."
14
+
15
+ text = pipe(audio)["text"]
16
+ return text
17
+
18
+
19
+ iface = gr.Interface(
20
+ fn=transcribe,
21
+ inputs=[
22
+ gr.Audio(source="microphone", type="filepath", optional=True),
23
+ gr.Audio(source="upload", type="filepath", optional=True),
24
+ ],
25
+ outputs="text",
26
+ title="Whisper Small Swedish",
27
+ description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper model.",
28
+ )
29
+
30
+
31
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ git+https://github.com/huggingface/transformers
2
+ torch