hamza666 commited on
Commit
bf59e76
1 Parent(s): 601dd7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,10 +1,11 @@
 
1
  from transformers import pipeline
2
  from datasets import load_dataset
3
  from datasets import Audio
4
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
5
 
6
 
7
- device = "cpu"
8
  pipe = pipeline(
9
  "automatic-speech-recognition", model="openai/whisper-base", device=device
10
  )
 
1
+ import torch
2
  from transformers import pipeline
3
  from datasets import load_dataset
4
  from datasets import Audio
5
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
6
 
7
 
8
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
9
  pipe = pipeline(
10
  "automatic-speech-recognition", model="openai/whisper-base", device=device
11
  )