MSaadTariq commited on
Commit
59c41a7
1 Parent(s): 6eb80ef

Create app.py

Browse files

Speak out Loud is a powerful speech-to-text app that uses cutting-edge speech recognition technology to transcribe spoken words and phrases into text with remarkable accuracy. With this app, you can easily convert your spoken words into written text, saving you time and effort.

Whether you're a student looking to take notes, a professional seeking to dictate reports, or an individual wanting to create content, Speak out Loud is the perfect tool for you. Simply speak into the microphone or upload an audio file, and our app will do the rest.

Our app uses a state-of-the-art speech recognition model that is trained on a vast amount of data, ensuring that it can recognize a wide range of voices, accents, and languages. This means that you can use Speak out Loud with confidence, knowing that your spoken words will be accurately transcribed into text.

So why wait? Try Speak out Loud today and experience the power of speech-to-text technology for yourself!

Files changed (1) hide show
  1. app.py +47 -0
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ asr = pipeline(task="automatic-speech-recognition",
4
+ model= "distil-whisper/distil-small.en")
5
+
6
+ import gradio as gr
7
+ demo = gr.Blocks()
8
+
9
+ def transcribe_long_form(filepath):
10
+ if filepath is None:
11
+ gr.Warning("No audio found, please retry")
12
+ return
13
+ output = asr(filepath,
14
+ max_new_tokens=256,
15
+ chunk_length_s=30,
16
+ batch_size=4,)
17
+ return output['text']
18
+
19
+ mic_transcribe = gr.Interface(
20
+ fn=transcribe_long_form,
21
+ inputs=gr.Audio(sources="microphone",
22
+ type="filepath"),
23
+ outputs=gr.Textbox(label="Transcription",
24
+ lines=3),
25
+ allow_flagging="never",
26
+ description="Speak into the microphone or upload an audio file to transcribe it into text. This model uses a state-of-the-art speech recognition algorithm to recognize spoken words and phrases")
27
+
28
+ file_transcribe = gr.Interface(
29
+ fn=transcribe_long_form,
30
+ inputs=gr.Audio(sources="upload",
31
+ type="filepath"),
32
+ outputs=gr.Textbox(label="Transcription",
33
+ lines=5),
34
+ allow_flagging="never",
35
+ description="Speak into the microphone or upload an audio file to transcribe it into text. This model uses a state-of-the-art speech recognition algorithm to recognize spoken words and phrases")
36
+ )
37
+
38
+
39
+ with demo:
40
+ gr.TabbedInterface(
41
+ [mic_transcribe,
42
+ file_transcribe],
43
+ ["Transcribe Microphone",
44
+ "Transcribe Audio File"],
45
+ title="Speak out Loud - Automatic Speech Recognition"
46
+ )
47
+ demo.launch()