shamik-lseg commited on
Commit
41f0cbd
1 Parent(s): 2e558c3

Creating all the files for a distil-whisper-demo.

Browse files
Files changed (5) hide show
  1. README.md +1 -1
  2. app.py +38 -0
  3. example0.flac +0 -0
  4. example2.flac +0 -0
  5. requirements.txt +2 -0
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Distil Whisper English Transcription
3
- emoji: 👀
4
  colorFrom: green
5
  colorTo: red
6
  sdk: gradio
 
1
  ---
2
  title: Distil Whisper English Transcription
3
+ emoji: ⚡⚡⚡
4
  colorFrom: green
5
  colorTo: red
6
  sdk: gradio
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+
5
+ MODEL_NAME = "Shamik/distil-whisper-small-polyAI-minds14"
6
+
7
+ pipe = pipeline(
8
+ task="automatic-speech-recognition",
9
+ model=MODEL_NAME,
10
+ chunk_length_s=30,
11
+ )
12
+
13
+ def transcribe(file):
14
+ outputs = pipe(file)
15
+ text = outputs["text"]
16
+ return text
17
+
18
+ demo = gr.Interface(
19
+ fn=transcribe,
20
+ inputs=[
21
+ gr.Audio(sources="upload", label="Audio file", type="filepath"),
22
+ ],
23
+ outputs="text",
24
+ title="Distil Whisper English Speech Transcription",
25
+ description=(
26
+ "Transcribe long-form audio inputs with the click of a button! Demo uses the"
27
+ f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
28
+ " of arbitrary length."
29
+ ),
30
+ examples=[
31
+ ["./example2.flac"],
32
+ ["./example0.flac"],
33
+ ],
34
+ cache_examples=True,
35
+ allow_flagging="never",
36
+ )
37
+
38
+ demo.launch()
example0.flac ADDED
Binary file (130 kB). View file
 
example2.flac ADDED
Binary file (305 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch