Spaces:
Runtime error
Runtime error
Abid Ali Awan
commited on
Commit
Β·
549eccc
1
Parent(s):
e8491b9
Add Urdu full stop handling in transcribe function of app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,15 @@ def transcribe(audio):
|
|
| 62 |
# Inference under no_grad
|
| 63 |
with torch.no_grad():
|
| 64 |
result = transcriber({"sampling_rate": sr, "raw": y})
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
# ββ Gradio UI ββ
|
|
|
|
| 62 |
# Inference under no_grad
|
| 63 |
with torch.no_grad():
|
| 64 |
result = transcriber({"sampling_rate": sr, "raw": y})
|
| 65 |
+
text = result.get("text", "")
|
| 66 |
+
# Add Urdu full stop if not present
|
| 67 |
+
if text:
|
| 68 |
+
text = text.rstrip()
|
| 69 |
+
if text.endswith("."):
|
| 70 |
+
text = text[:-1] + "Ϋ"
|
| 71 |
+
elif not text.endswith("Ϋ"):
|
| 72 |
+
text = text + "Ϋ"
|
| 73 |
+
return text
|
| 74 |
|
| 75 |
|
| 76 |
# ββ Gradio UI ββ
|