Abid Ali Awan commited on
Commit
549eccc
Β·
1 Parent(s): e8491b9

Add Urdu full stop handling in transcribe function of app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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
- return result.get("text", "")
 
 
 
 
 
 
 
 
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 β€”β€”