Irpan commited on
Commit
a95ac22
·
1 Parent(s): c152595
Files changed (3) hide show
  1. app.py +4 -6
  2. asr.py +2 -0
  3. util.py +8 -8
app.py CHANGED
@@ -15,8 +15,6 @@ with gr.Blocks() as app:
15
  <p style="text-align: center; font-size: 16px; color: #555;">
16
  This app is designed to help users practice Uyghur pronunciation.
17
  </p>
18
-
19
- Select an input script, enter or generate text, and check your pronunciation. You may also generate AI pronunciation to compare.
20
 
21
  (Note: Please keep the audio input to under 10 seconds for faster processing since this space is running on CPU basic.)
22
 
@@ -38,7 +36,7 @@ with gr.Blocks() as app:
38
  with gr.Group():
39
  with gr.Row():
40
  input_text = gr.Textbox(
41
- label="2. Enter Uyghur Text in Chosen Script (or Click a Button Below to Generate Text)",
42
  placeholder="Enter Uyghur text here...",
43
  )
44
  with gr.Row():
@@ -62,14 +60,14 @@ with gr.Blocks() as app:
62
  # TTS
63
  with gr.Group():
64
  with gr.Row():
65
- example_audio = gr.Audio(label="(OPTIONAL) Generate AI Pronunciation")
66
  with gr.Row():
67
- tts_btn = gr.Button("Generate AI Pronunciation")
68
  # ASR
69
  with gr.Group():
70
  with gr.Row():
71
  user_audio = gr.Audio(
72
- label="3. Record or Upload Your Pronunciation",
73
  sources=["microphone", "upload"],
74
  type="filepath",
75
  )
 
15
  <p style="text-align: center; font-size: 16px; color: #555;">
16
  This app is designed to help users practice Uyghur pronunciation.
17
  </p>
 
 
18
 
19
  (Note: Please keep the audio input to under 10 seconds for faster processing since this space is running on CPU basic.)
20
 
 
36
  with gr.Group():
37
  with gr.Row():
38
  input_text = gr.Textbox(
39
+ label="2. Generate or Enter Text in Selected Script",
40
  placeholder="Enter Uyghur text here...",
41
  )
42
  with gr.Row():
 
60
  # TTS
61
  with gr.Group():
62
  with gr.Row():
63
+ example_audio = gr.Audio(label="3. Generate Example Pronunciation")
64
  with gr.Row():
65
+ tts_btn = gr.Button("Generate Example Pronunciation")
66
  # ASR
67
  with gr.Group():
68
  with gr.Row():
69
  user_audio = gr.Audio(
70
+ label="4. Record or Upload Your Pronunciation",
71
  sources=["microphone", "upload"],
72
  type="filepath",
73
  )
asr.py CHANGED
@@ -58,4 +58,6 @@ def check_pronunciation(input_text, script_choice, user_audio):
58
  output_text = transcript_ugArab_box,
59
  script_choice=script_choice)
60
 
 
 
61
  return transcript_ugArab_box, transcript_ugLatn_box, correct_phoneme, user_phoneme, pronunciation_match, pronunciation_score
 
58
  output_text = transcript_ugArab_box,
59
  script_choice=script_choice)
60
 
61
+ print(f"ASR: {transcript_ugLatn_box}")
62
+
63
  return transcript_ugArab_box, transcript_ugLatn_box, correct_phoneme, user_phoneme, pronunciation_match, pronunciation_score
util.py CHANGED
@@ -60,14 +60,14 @@ def generate_long_text(script_choice):
60
  text = random.choice(long_texts)
61
  return ug_arab_to_latn(text) if script_choice == "Uyghur Latin" else text
62
 
63
- def translate_text(input_text, script_choice, target_language):
64
- """
65
- Translate Uyghur text to the target language
66
- """
67
- if script_choice == 'Uyghur Latin':
68
- input_text = ug_latn_to_arab(input_text)
69
- translated_text = translator.translate(input_text, src="ug", dest=LANGCODES[target_language])
70
- return translated_text.text
71
 
72
  ## ASR Utils
73
  def remove_punctuation(text):
 
60
  text = random.choice(long_texts)
61
  return ug_arab_to_latn(text) if script_choice == "Uyghur Latin" else text
62
 
63
+ # def translate_text(input_text, script_choice, target_language):
64
+ # """
65
+ # Translate Uyghur text to the target language
66
+ # """
67
+ # if script_choice == 'Uyghur Latin':
68
+ # input_text = ug_latn_to_arab(input_text)
69
+ # translated_text = translator.translate(input_text, src="ug", dest=LANGCODES[target_language])
70
+ # return translated_text.text
71
 
72
  ## ASR Utils
73
  def remove_punctuation(text):