Norphel commited on
Commit
23f9512
·
verified ·
1 Parent(s): d173c6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -29,9 +29,9 @@ def generate_text(audio):
29
  print(sr, data.dtype)
30
  input_dict = asr_processor(data, sampling_rate=sr, return_tensors="pt", padding=True)
31
 
32
- # Ensure that the input tensor is moved to the correct device (GPU or CPU)
33
- logits = asr_model(input_dict.input_values.to(device)).logits
34
- pred_ids = torch.argmax(logits, dim=-1)[0]
35
 
36
  # Decode the prediction
37
  return asr_processor.decode(pred_ids)
 
29
  print(sr, data.dtype)
30
  input_dict = asr_processor(data, sampling_rate=sr, return_tensors="pt", padding=True)
31
 
32
+ with torch.no_grad():
33
+ outputs = model(**inputs).logits
34
+ pred_ids = torch.argmax(outputs, dim=-1)[0]
35
 
36
  # Decode the prediction
37
  return asr_processor.decode(pred_ids)