Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -8,16 +8,17 @@ from huggingface_hub import login
|
|
8 |
warnings.filterwarnings("ignore")
|
9 |
|
10 |
|
11 |
-
#
|
12 |
tokenizer = WhisperTokenizer.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
13 |
model = WhisperForConditionalGeneration.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
14 |
processor = WhisperProcessor.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
15 |
|
16 |
-
# Set up
|
17 |
-
device =
|
|
|
18 |
torch_dtype = torch.float32
|
|
|
19 |
|
20 |
-
@spaces.GPU
|
21 |
def transcribe_audio(audio_file):
|
22 |
audio_input, _ = sf.read(audio_file)
|
23 |
inputs = processor(audio_input, sampling_rate=16000, return_tensors="pt")
|
|
|
8 |
warnings.filterwarnings("ignore")
|
9 |
|
10 |
|
11 |
+
# tokenizer, model
|
12 |
tokenizer = WhisperTokenizer.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
13 |
model = WhisperForConditionalGeneration.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
14 |
processor = WhisperProcessor.from_pretrained("NbAiLabBeta/nb-whisper-medium")
|
15 |
|
16 |
+
# Set up device
|
17 |
+
device = ('cuda')
|
18 |
+
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
19 |
torch_dtype = torch.float32
|
20 |
+
model.to(device)
|
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")
|