import gradio as gr import util import tts import asr # Front-End with gr.Blocks() as app: # Title and Article with gr.Row(): gr.Markdown( """ # Uyghur Pronunciation Checker This app is designed to help users practice Uyghur pronunciation. Select an uyghur script, enter or generate text, and check your pronunciation. You may also generate AI pronunciation to compare. Note: Please keep the audio input to under 10 seconds for faster processing since this space is running on CPU basic. """ ) with gr.Row(): # Input Column with gr.Column(scale=1): # Script with gr.Row(): script_choice = gr.Dropdown( choices=["Uyghur Arabic", "Uyghur Latin"], label="1. Select Uyghur Script", value="Uyghur Arabic", interactive=True ) # Text with gr.Group(): with gr.Row(): input_text = gr.Textbox( label="2. Enter Uyghur Text in Chosen Script (or Click a Button Below to Generate Text)", placeholder="Enter Uyghur text here...", ) with gr.Row(): generate_short_btn = gr.Button("Generate Short Text") generate_long_btn = gr.Button("Generate Long Text") # Translations # with gr.Group(): # with gr.Row(): # translate_choice = gr.Dropdown( # choices=util.translation_choices, # label="(Optional) Select Translation Langauge and Translate", # value="english", # interactive=True # ) # translate_btn = gr.Button("Translate") # with gr.Row(): # translation_text = gr.Textbox( # label=" Translated Uyghur Text", # placeholder="Translated text will appear here...", # ) # TTS with gr.Group(): with gr.Row(): example_audio = gr.Audio(label="(Optional) Generate AI Pronunciation") with gr.Row(): tts_btn = gr.Button("Generate AI Pronunciation") # ASR with gr.Group(): with gr.Row(): user_audio = gr.Audio( label="3. Record or Upload Your Pronunciation", sources=["microphone", "upload"], type="filepath", ) with gr.Row(): check_btn = gr.Button("Check My Pronunciation") # Output Column with gr.Column(scale=1): # ASR Transcripts with gr.Group(): with gr.Row(): transcript_ugArab_box = gr.Textbox( label="User Transcript (Arabic Script)", placeholder="ASR transcription of user audio..." ) with gr.Row(): transcript_ugLatn_box = gr.Textbox( label="User Transcript (Latin Script)", placeholder="ASR transcription of user audio..." ) # IPA with gr.Group(): with gr.Row(): correct_phoneme_box = gr.Textbox( label="Correct Phonemes", placeholder="IPA representation of the Correct pronunciation..." ) with gr.Row(): user_phoneme_box = gr.Textbox( label="User Phonemes", placeholder="IPA representation of the user pronunciation..." ) # Feedback with gr.Group(): with gr.Row(): match_box = gr.Markdown( """