Spaces:
Sleeping
Sleeping
adding the initial UI placement
Browse files
app.py
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
with gr.Blocks(title = "AIvatar") as ai_avatar:
|
| 5 |
+
with gr.Row():
|
| 6 |
+
audio_file = gr.Audio()
|
| 7 |
+
|
| 8 |
+
with gr.Row():
|
| 9 |
+
input_text = gr.Textbox(label="Input text")
|
| 10 |
+
# source_language = gr.Dropdown(list(constants.flores_codes.keys()), value='English', label='Source (Autoselected)', interactive=True)
|
| 11 |
+
|
| 12 |
+
with gr.Row():
|
| 13 |
+
output_text = gr.Textbox(label='Translated text')
|
| 14 |
+
# target_language = gr.Dropdown(list(constants.flores_codes.keys()), value='German', label='Target', interactive=True)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
with gr.Row():
|
| 18 |
+
output_speech = gr.Audio(label='Translated speech')
|
| 19 |
+
translate_button = gr.Button('Translate')
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
with gr.Row():
|
| 23 |
+
enhance_audio = gr.Radio(['yes', 'no'], value='yes', label='Enhance input voice', interactive=True)
|
| 24 |
+
input_type = gr.Radio(['Whole text', 'Sentence-wise'],value='Sentence-wise', label="Translation Mode", interactive=True)
|
| 25 |
+
output_audio_type = gr.Radio(['standard speaker', 'voice transfer'], value='voice transfer', label='Enhance output voice', interactive=True)
|
| 26 |
+
|
| 27 |
+
# audio_file.change(speech_to_text,
|
| 28 |
+
# inputs=[audio_file],
|
| 29 |
+
# outputs=[input_text, source_language])
|
| 30 |
+
|
| 31 |
+
# translate_button.click(translation,
|
| 32 |
+
# inputs=[audio_file, input_text,
|
| 33 |
+
# source_language, target_language,
|
| 34 |
+
# output_audio_type, input_type],
|
| 35 |
+
# outputs=[output_text, output_speech])
|
| 36 |
+
|
| 37 |
+
ai_avatar.launch(share=False)
|