File size: 1,614 Bytes
e8b79fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr


with gr.Blocks(title = "AIvatar") as ai_avatar:
    with gr.Row():
        audio_file = gr.Audio()
    
    with gr.Row():
        input_text  = gr.Textbox(label="Input text")
        # source_language     = gr.Dropdown(list(constants.flores_codes.keys()), value='English', label='Source (Autoselected)', interactive=True)
    
    with gr.Row():
        output_text = gr.Textbox(label='Translated text')
        # target_language  = gr.Dropdown(list(constants.flores_codes.keys()), value='German', label='Target', interactive=True)
    
    
    with gr.Row():
        output_speech = gr.Audio(label='Translated speech')
        translate_button = gr.Button('Translate')

    
    with gr.Row():
        enhance_audio       = gr.Radio(['yes', 'no'], value='yes', label='Enhance input voice', interactive=True)
        input_type          = gr.Radio(['Whole text', 'Sentence-wise'],value='Sentence-wise', label="Translation Mode", interactive=True)
        output_audio_type   = gr.Radio(['standard speaker', 'voice transfer'], value='voice transfer', label='Enhance output voice', interactive=True)

    # audio_file.change(speech_to_text,
    #                   inputs=[audio_file],
    #                   outputs=[input_text, source_language])

    # translate_button.click(translation,
    #                        inputs=[audio_file, input_text, 
    #                                source_language, target_language, 
    #                                output_audio_type, input_type],
    #                        outputs=[output_text, output_speech])

ai_avatar.launch(share=False)