Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
import torchaudio
|
@@ -6,6 +7,7 @@ from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
|
|
6 |
model = AutoModelForCTC.from_pretrained("anzorq/w2v-bert-2.0-kbd")
|
7 |
processor = Wav2Vec2BertProcessor.from_pretrained("anzorq/w2v-bert-2.0-kbd")
|
8 |
|
|
|
9 |
def transcribe_speech(audio):
|
10 |
# Load the audio file
|
11 |
waveform, sr = torchaudio.load(audio)
|
@@ -35,7 +37,6 @@ def transcribe_speech(audio):
|
|
35 |
|
36 |
return pred_text
|
37 |
|
38 |
-
# Define the Gradio interface
|
39 |
interface = gr.Interface(
|
40 |
fn=transcribe_speech,
|
41 |
inputs=gr.Audio(sources="microphone", type="filepath"),
|
@@ -43,5 +44,4 @@ interface = gr.Interface(
|
|
43 |
live=True,
|
44 |
)
|
45 |
|
46 |
-
# Launch the app
|
47 |
interface.launch()
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
import torchaudio
|
|
|
7 |
model = AutoModelForCTC.from_pretrained("anzorq/w2v-bert-2.0-kbd")
|
8 |
processor = Wav2Vec2BertProcessor.from_pretrained("anzorq/w2v-bert-2.0-kbd")
|
9 |
|
10 |
+
@spaces.GPU
|
11 |
def transcribe_speech(audio):
|
12 |
# Load the audio file
|
13 |
waveform, sr = torchaudio.load(audio)
|
|
|
37 |
|
38 |
return pred_text
|
39 |
|
|
|
40 |
interface = gr.Interface(
|
41 |
fn=transcribe_speech,
|
42 |
inputs=gr.Audio(sources="microphone", type="filepath"),
|
|
|
44 |
live=True,
|
45 |
)
|
46 |
|
|
|
47 |
interface.launch()
|