Bisher commited on
Commit
a325594
·
verified ·
1 Parent(s): c0436dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -71,15 +71,19 @@ except:
71
 
72
  # ---------- Core Functions ----------
73
  def diacritize_text(model_type, input_text):
 
 
 
74
  text_clean = remove_non_arabic(input_text.strip())
75
  if not text_clean:
76
- return "Please enter some Arabic text."
77
  x = [text_clean]
78
  if model_type == "Encoder-Decoder":
79
- out = model_ed.do_tashkeel_batch(x, batch_size=16, verbose=False)
80
  else:
81
- out = model_eo.do_tashkeel_batch(x, batch_size=16, verbose=False)
82
- return out[0] if out else ""
 
83
 
84
 
85
  def get_and_process_syllables(audio_path):
 
71
 
72
  # ---------- Core Functions ----------
73
  def diacritize_text(model_type, input_text):
74
+ """
75
+ Returns the diacritized text twice: once for display, once for state storage.
76
+ """
77
  text_clean = remove_non_arabic(input_text.strip())
78
  if not text_clean:
79
+ return "Please enter some Arabic text.", ""
80
  x = [text_clean]
81
  if model_type == "Encoder-Decoder":
82
+ outputs = model_ed.do_tashkeel_batch(x, batch_size=16, verbose=False)
83
  else:
84
+ outputs = model_eo.do_tashkeel_batch(x, batch_size=16, verbose=False)
85
+ result = outputs[0] if outputs else ""
86
+ return result, result
87
 
88
 
89
  def get_and_process_syllables(audio_path):