Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -357,6 +357,29 @@ def transcribe_hindi(speech):
|
|
357 |
for hindi, num in hindi_map.items():
|
358 |
text = text.replace(hindi, num)
|
359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
return text
|
361 |
|
362 |
###########################################################
|
|
|
357 |
for hindi, num in hindi_map.items():
|
358 |
text = text.replace(hindi, num)
|
359 |
|
360 |
+
# Split the string into parts separated by spaces
|
361 |
+
parts = asr_output.split(' ')
|
362 |
+
|
363 |
+
# Initialize an empty list to store the processed parts
|
364 |
+
processed_parts = []
|
365 |
+
|
366 |
+
# Iterate over each part
|
367 |
+
for part in parts:
|
368 |
+
# Check if the part is a number (contains only digits)
|
369 |
+
if part.isdigit():
|
370 |
+
# If the previous part was also a number, concatenate them
|
371 |
+
if processed_parts and processed_parts[-1].isdigit():
|
372 |
+
processed_parts[-1] += part
|
373 |
+
else:
|
374 |
+
processed_parts.append(part)
|
375 |
+
else:
|
376 |
+
# If the part is not a number, add it to the list as is
|
377 |
+
processed_parts.append(part)
|
378 |
+
|
379 |
+
# Join the processed parts back into a string with spaces
|
380 |
+
text = ' '.join(processed_parts)
|
381 |
+
|
382 |
+
|
383 |
return text
|
384 |
|
385 |
###########################################################
|