micknikolic commited on
Commit
73222a5
1 Parent(s): 21457d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import accelerate
2
  import gradio as gr
3
  import time
4
  import io
@@ -12,7 +11,7 @@ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
12
 
13
  model = AutoModelForSpeechSeq2Seq.from_pretrained(pretrained_model_name_or_path= "openai/whisper-large-v3",
14
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
15
- use_safetensors=True).to("cuda")
16
 
17
  #Instantiating the processor object.
18
 
@@ -28,8 +27,8 @@ pipe = pipeline(task="automatic-speech-recognition",
28
  chunk_length_s=30,
29
  batch_size=16,
30
  return_timestamps=True,
31
- torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
32
- device="cuda")
33
 
34
  #Defining speech-to-text function.
35
 
 
 
1
  import gradio as gr
2
  import time
3
  import io
 
11
 
12
  model = AutoModelForSpeechSeq2Seq.from_pretrained(pretrained_model_name_or_path= "openai/whisper-large-v3",
13
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
14
+ use_safetensors=True)
15
 
16
  #Instantiating the processor object.
17
 
 
27
  chunk_length_s=30,
28
  batch_size=16,
29
  return_timestamps=True,
30
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
31
+ )
32
 
33
  #Defining speech-to-text function.
34