mrfakename commited on
Commit
a00f7c2
0 Parent(s):

Super-squash branch 'main' using huggingface_hub

Browse files
Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +56 -0
  4. requirements.txt +1 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ title: Fast Whisper Turbo
4
+ sdk: gradio
5
+ emoji: ⚡
6
+ colorFrom: yellow
7
+ colorTo: yellow
8
+ short_description: Ultra-fast Whisper Turbo inference ⚡
9
+ sdk_version: 5.0.0
10
+ pinned: true
11
+ preload_from_hub:
12
+ - openai/whisper-large-v3-turbo
13
+ ---
app.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ABOUT = """
2
+ # Fast Whisper Turbo ⚡
3
+
4
+ Ultra-fast Whisper V3 Turbo inference, with enhancements sourced from [insanely-fast-whisper](https://github.com/Vaibhavs10/insanely-fast-whisper).
5
+ """
6
+
7
+ CREDITS = """
8
+ ## Credits
9
+
10
+ This project was made possible through the work of several other projects:
11
+
12
+ - [insanely-fast-whisper](https://github.com/Vaibhavs10/insanely-fast-whisper)
13
+ """
14
+
15
+ import subprocess
16
+ subprocess.run(
17
+ "pip install flash-attn --no-build-isolation",
18
+ env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
19
+ shell=True,
20
+ ) # https://huggingface.co/spaces/zero-gpu-explorers/README/discussions/75#666e4681303f0a5d67175a90
21
+ import gradio as gr
22
+ from transformers import pipeline
23
+ import torch
24
+ import spaces
25
+
26
+ pipe = pipeline(
27
+ "automatic-speech-recognition",
28
+ model="openai/whisper-large-v3-turbo",
29
+ torch_dtype=torch.float16,
30
+ device="cuda:0",
31
+ model_kwargs={"attn_implementation": "flash_attention_2"},
32
+ )
33
+
34
+ @spaces.GPU
35
+ def transcribe(audio, task):
36
+ gr.Info("Starting transcription task")
37
+ outputs = pipe(
38
+ audio,
39
+ chunk_length_s=30,
40
+ batch_size=128,
41
+ generate_kwargs={"task": task},
42
+ return_timestamps=False,
43
+ )
44
+ gr.Info("Finished transcription task")
45
+ return outputs['text'].strip()
46
+
47
+ with gr.Blocks() as demo:
48
+ gr.Markdown(ABOUT)
49
+ audio = gr.Audio(label="Audio", type="filepath", interactive=True)
50
+ task = gr.Radio(["transcribe", "translate"], label="Task", value="transcribe", interactive=True)
51
+ btn = gr.Button("Transcribe", variant="primary")
52
+ output = gr.Textbox(label="Transcription", interactive=False)
53
+ btn.click(transcribe, inputs=[audio, task], outputs=output)
54
+ gr.Markdown(CREDITS)
55
+
56
+ demo.queue().launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ transformers[torch]