Spaces:
Build error
Build error
camparchimedes
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,8 @@ import warnings
|
|
3 |
import torch
|
4 |
from transformers import WhisperTokenizer, WhisperForConditionalGeneration, WhisperProcessor
|
5 |
import soundfile as sf
|
|
|
|
|
6 |
|
7 |
warnings.filterwarnings("ignore")
|
8 |
|
@@ -18,7 +20,7 @@ torch_dtype = torch.float32
|
|
18 |
# move model to device
|
19 |
model.to(device)
|
20 |
|
21 |
-
|
22 |
def transcribe_audio(audio_file):
|
23 |
audio_input, _ = sf.read(audio_file)
|
24 |
inputs = processor(audio_input, sampling_rate=16000, return_tensors="pt")
|
@@ -54,4 +56,5 @@ with iface:
|
|
54 |
transcribe_button.click(fn=transcribe_audio, inputs=audio_input, outputs=transcription_output)
|
55 |
|
56 |
# Launch the interface
|
57 |
-
iface.launch(share=True, debug=True)
|
|
|
|
3 |
import torch
|
4 |
from transformers import WhisperTokenizer, WhisperForConditionalGeneration, WhisperProcessor
|
5 |
import soundfile as sf
|
6 |
+
from huggingface_hub import spaces
|
7 |
+
|
8 |
|
9 |
warnings.filterwarnings("ignore")
|
10 |
|
|
|
20 |
# move model to device
|
21 |
model.to(device)
|
22 |
|
23 |
+
@spaces.GPU
|
24 |
def transcribe_audio(audio_file):
|
25 |
audio_input, _ = sf.read(audio_file)
|
26 |
inputs = processor(audio_input, sampling_rate=16000, return_tensors="pt")
|
|
|
56 |
transcribe_button.click(fn=transcribe_audio, inputs=audio_input, outputs=transcription_output)
|
57 |
|
58 |
# Launch the interface
|
59 |
+
iface.launch(share=True, debug=True)
|
60 |
+
|