Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1297,7 +1297,25 @@ def generate_map(location_names):
|
|
1297 |
).add_to(m)
|
1298 |
map_html = m._repr_html_()
|
1299 |
return map_html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1300 |
|
|
|
|
|
|
|
1301 |
def update_map_with_response(history):
|
1302 |
if not history:
|
1303 |
return ""
|
|
|
1297 |
).add_to(m)
|
1298 |
map_html = m._repr_html_()
|
1299 |
return map_html
|
1300 |
+
def transcribe_function(stream, new_chunk):
|
1301 |
+
try:
|
1302 |
+
sr, y = new_chunk[0], new_chunk[1]
|
1303 |
+
except TypeError:
|
1304 |
+
print(f"Error chunk structure: {type(new_chunk)}, content: {new_chunk}")
|
1305 |
+
return stream, "", None
|
1306 |
+
|
1307 |
+
y = y.astype(np.float32) / np.max(np.abs(y))
|
1308 |
+
|
1309 |
+
if stream is not None:
|
1310 |
+
stream = np.concatenate([stream, y])
|
1311 |
+
else:
|
1312 |
+
stream = y
|
1313 |
+
|
1314 |
+
result = pipe_asr({"array": stream, "sampling_rate": sr}, return_timestamps=False)
|
1315 |
|
1316 |
+
full_text = result.get("text", "")
|
1317 |
+
|
1318 |
+
return stream, full_text, result
|
1319 |
def update_map_with_response(history):
|
1320 |
if not history:
|
1321 |
return ""
|