mrfakename commited on
Commit
83f7baa
β€’
0 Parent(s):

Super-squash branch 'main' using huggingface_hub

Browse files
Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +13 -0
  3. app.py +38 -0
  4. requirements.txt +4 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Moonshine ASR
3
+ emoji: πŸŒ’
4
+ colorFrom: gray
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 5.1.0
8
+ app_file: app.py
9
+ pinned: true
10
+ short_description: Fast & efficient ASR outperforming Whisper!
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ABOUT = """
2
+ # Moonshine ASR
3
+
4
+ Unofficial demo for [Moonshine ASR](https://github.com/usefulsensors/moonshine) by Useful Sensors, a fast & efficient ASR model outperforming Whisper
5
+ """
6
+
7
+ import os
8
+ os.environ["KERAS_BACKEND"] = "torch"
9
+
10
+ import gradio as gr
11
+
12
+ import spaces
13
+
14
+ import moonshine
15
+
16
+ from pydub import AudioSegment
17
+
18
+ @spaces.GPU
19
+ def transcribe(audio, chosen_model):
20
+ audio_file = AudioSegment.from_file(audio)
21
+ if len(audio_file) / 1000 >= 64:
22
+ raise gr.Error("Moonshine only supports audio segments up to 64s long. Please pre-segment your audio and try again.")
23
+ try:
24
+ transcription = moonshine.transcribe(audio, chosen_model)
25
+ except Exception as e:
26
+ raise gr.Error("Moonshine backend error: " + str(e))
27
+ return ' '.join(transcription).strip()
28
+
29
+ with gr.Blocks() as demo:
30
+ gr.Markdown(ABOUT)
31
+ aud = gr.Audio(label="Audio", type="filepath", interactive=True)
32
+ modelname = gr.Radio(label="Model", choices=['moonshine/tiny', 'moonshine/base'], value="moonshine/tiny", interactive=True)
33
+ btn = gr.Button("Transcribe", variant="primary")
34
+ out = gr.Textbox(label="Transcription", interactive=False)
35
+ btn.click(transcribe, inputs=[aud, modelname], outputs=out)
36
+ gr.Markdown("Unofficial demo by [mrfakename](https://x.com/realmrfakename)")
37
+
38
+ demo.queue().launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ torchaudio
3
+ useful-moonshine@git+https://github.com/usefulsensors/moonshine.git
4
+ pydub