Lenylvt commited on
Commit
c31e25e
1 Parent(s): ba26f10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,8 +15,8 @@ def format_timestamp(seconds):
15
 
16
  def transcribe(audio_file, model_size):
17
  # Initialize the Whisper model based on the selected model size
18
- device = "cpu" # GPU : cuda CPU : cpu
19
- compute_type = "int8" # GPU : float16 or int8 - CPU : int8
20
 
21
  model = WhisperModel(model_size, device=device, compute_type=compute_type)
22
 
 
15
 
16
  def transcribe(audio_file, model_size):
17
  # Initialize the Whisper model based on the selected model size
18
+ device = "cuda" if torch.cuda.is_available() else "cpu"
19
+ compute_type = "float16" if device == "cuda" else "int8"
20
 
21
  model = WhisperModel(model_size, device=device, compute_type=compute_type)
22