Yehor Smoliakov commited on
Commit
a276256
·
1 Parent(s): 38910d3
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -26,7 +26,9 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
26
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
27
 
28
  # Load the model
29
- asr_model = HubertForCTC.from_pretrained(model_name, torch_dtype=torch_dtype, device_map=device)
 
 
30
  processor = Wav2Vec2Processor.from_pretrained(model_name)
31
 
32
  if use_torch_compile:
@@ -159,7 +161,9 @@ def inference(audio_path, progress=gr.Progress()):
159
 
160
  audio_input = audio_input.squeeze(0).numpy()
161
 
162
- inputs = processor([audio_input], sampling_rate=16_000, padding=True).input_values
 
 
163
  features = torch.tensor(np.array(inputs), dtype=torch_dtype).to(device)
164
 
165
  with torch.inference_mode():
 
26
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
27
 
28
  # Load the model
29
+ asr_model = HubertForCTC.from_pretrained(
30
+ model_name, torch_dtype=torch_dtype, device_map=device
31
+ )
32
  processor = Wav2Vec2Processor.from_pretrained(model_name)
33
 
34
  if use_torch_compile:
 
161
 
162
  audio_input = audio_input.squeeze(0).numpy()
163
 
164
+ inputs = processor(
165
+ [audio_input], sampling_rate=16_000, padding=True
166
+ ).input_values
167
  features = torch.tensor(np.array(inputs), dtype=torch_dtype).to(device)
168
 
169
  with torch.inference_mode():