Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
|
@@ -72,8 +72,11 @@ def generate_answer(image, question):
|
|
| 72 |
return answer_ru
|
| 73 |
|
| 74 |
|
| 75 |
-
def transcribe(image,
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|