SebLih commited on
Commit
0b6b858
·
1 Parent(s): 232322f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install datasets>=2.6.1
2
+ !pip install git+https://github.com/huggingface/transformers
3
+ !pip install librosa
4
+ !pip install evaluate>=0.30
5
+ !pip install jiwer
6
+ !pip install gradio
7
+ !pip install transformers
8
+
9
+ import gradio as gr
10
+ from transformers import pipeline
11
+ from huggingface_hub import login
12
+
13
+ login("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", add_to_git_credential=True)
14
+
15
+
16
+ pipe = pipeline(model="SebLih/whisper-SV") # change to "your-username/the-name-you-picked"
17
+
18
+ def transcribe(audio):
19
+ text = pipe(audio)["text"]
20
+ print("Transcribed text:")
21
+ print(text)
22
+ return text
23
+
24
+ iface = gr.Interface(
25
+ fn=transcribe,
26
+ inputs=gr.Audio(source="microphone", type="filepath"),
27
+ outputs="text",
28
+ title="Whisper Small Swedish",
29
+ description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
30
+ )
31
+
32
+ iface.launch(share=True)