mkfallah commited on
Commit
5901b41
·
verified ·
1 Parent(s): 1e401c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -19,7 +19,7 @@ custom_vocab_map = {
19
 
20
  def replace_fuzzy(text, vocab_map, threshold=85):
21
  """
22
- Replace words/phrases in text using fuzzy matching with high threshold.
23
  """
24
  for target, alternatives in vocab_map.items():
25
  result = process.extractOne(text, alternatives, scorer=fuzz.partial_ratio)
@@ -48,7 +48,7 @@ def transcribe(audio_file):
48
  return f"ASR error: {e}"
49
 
50
  text = result.get("text", "")
51
- final_text = replace_fuzzy(text, custom_vocab_map, threshold=85)
52
  return final_text
53
 
54
  # Gradio interface
@@ -57,7 +57,7 @@ iface = gr.Interface(
57
  inputs=gr.Audio(type="filepath", label="Record or upload audio"),
58
  outputs="text",
59
  title="Persian ASR with High Accuracy Vocabulary",
60
- description="""Speak in Persian or upload an audio file; recognized words
61
  are corrected using a custom high-accuracy vocabulary."""
62
  )
63
 
 
19
 
20
  def replace_fuzzy(text, vocab_map, threshold=85):
21
  """
22
+ Replace words/phrases in text using fuzzy matching with a high threshold.
23
  """
24
  for target, alternatives in vocab_map.items():
25
  result = process.extractOne(text, alternatives, scorer=fuzz.partial_ratio)
 
48
  return f"ASR error: {e}"
49
 
50
  text = result.get("text", "")
51
+ final_text = replace_fuzzy(text, custom_vocab_map, threshold=80)
52
  return final_text
53
 
54
  # Gradio interface
 
57
  inputs=gr.Audio(type="filepath", label="Record or upload audio"),
58
  outputs="text",
59
  title="Persian ASR with High Accuracy Vocabulary",
60
+ description=""" Speak in Persian or upload an audio file; recognized words
61
  are corrected using a custom high-accuracy vocabulary."""
62
  )
63