andgrt commited on
Commit
7ce07b6
1 Parent(s): 835a80e
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -72,8 +72,11 @@ def generate_answer(image, question):
72
  return answer_ru
73
 
74
 
75
- def transcribe(image, new_chunk):
76
- sr, y = new_chunk
 
 
 
77
 
78
  # Convert to mono if stereo
79
  if y.ndim > 1:
@@ -81,7 +84,6 @@ def transcribe(image, new_chunk):
81
 
82
  y = y.astype(np.float32)
83
  y /= np.max(np.abs(y))
84
-
85
  return generate_answer(image, transcriber({"sampling_rate": sr, "raw": y})["text"])
86
 
87
 
 
72
  return answer_ru
73
 
74
 
75
+ def transcribe(image, audio):
76
+ if not image or not audio:
77
+ return
78
+
79
+ sr, y = audio
80
 
81
  # Convert to mono if stereo
82
  if y.ndim > 1:
 
84
 
85
  y = y.astype(np.float32)
86
  y /= np.max(np.abs(y))
 
87
  return generate_answer(image, transcriber({"sampling_rate": sr, "raw": y})["text"])
88
 
89