demavior commited on
Commit
9ad5b8c
·
verified ·
1 Parent(s): e07643f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -15,8 +15,8 @@ def transcribe(audio):
15
  if not isinstance(audio_data, np.ndarray):
16
  audio_data = np.array(audio_data)
17
 
18
- # Convert to a tensor
19
- audio_tensor = torch.tensor(audio_data)
20
 
21
  # Convert to mono if the audio is stereo
22
  if audio_tensor.ndim > 1:
@@ -39,6 +39,8 @@ def transcribe(audio):
39
 
40
  prediction = pipe(audio_tensor)["text"]
41
  return prediction
 
 
42
  gradio_app = gr.Interface(
43
  fn=transcribe,
44
  inputs=gr.Audio(label="Input"),
 
15
  if not isinstance(audio_data, np.ndarray):
16
  audio_data = np.array(audio_data)
17
 
18
+ # Convert to a tensor and ensure it's a floating-point type
19
+ audio_tensor = torch.tensor(audio_data, dtype=torch.float32)
20
 
21
  # Convert to mono if the audio is stereo
22
  if audio_tensor.ndim > 1:
 
39
 
40
  prediction = pipe(audio_tensor)["text"]
41
  return prediction
42
+
43
+
44
  gradio_app = gr.Interface(
45
  fn=transcribe,
46
  inputs=gr.Audio(label="Input"),