Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -151,6 +151,24 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
151 |
audio_input = gr.Audio(sources=["microphone"], type="filepath", label="Speak Now")
|
152 |
direction_voice = gr.Dropdown(choices=list(MODEL_MAP.keys()), label="Translation Direction", value="English β Swahili")
|
153 |
tone_voice = gr.Radio(choices=list(TONE_MODIFIERS.keys()), label="Tone", value="Neutral")
|
154 |
-
voice_output = gr.Text
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
audio_input = gr.Audio(sources=["microphone"], type="filepath", label="Speak Now")
|
152 |
direction_voice = gr.Dropdown(choices=list(MODEL_MAP.keys()), label="Translation Direction", value="English β Swahili")
|
153 |
tone_voice = gr.Radio(choices=list(TONE_MODIFIERS.keys()), label="Tone", value="Neutral")
|
154 |
+
voice_output = gr.Textbox(label="Translated Text")
|
155 |
+
voice_select2 = gr.Dropdown(choices=list(VOICE_IDS.keys()), label="Voice", value="Rachel (Female)")
|
156 |
+
voice_translate_btn = gr.Button("Transcribe & Translate")
|
157 |
+
voice_speak_btn = gr.Button("π Speak Translation")
|
158 |
+
audio_output2 = gr.Audio(label="Playback", interactive=False)
|
159 |
+
|
160 |
+
translate_btn.click(fn=translate, inputs=[input_text, direction, tone], outputs=output_text)
|
161 |
+
speak_btn.click(fn=tts_via_api, inputs=[output_text, voice_select], outputs=audio_output)
|
162 |
+
voice_translate_btn.click(fn=transcribe_and_translate, inputs=[audio_input, direction_voice, tone_voice], outputs=voice_output)
|
163 |
+
voice_speak_btn.click(fn=tts_via_api, inputs=[voice_output, voice_select2], outputs=audio_output2)
|
164 |
+
|
165 |
+
gr.Markdown(
|
166 |
+
"""<div style='text-align: center;'>
|
167 |
+
<a href='https://eng-jobbers.vercel.app/' target='_blank' style='text-decoration: none; font-weight: bold;'>
|
168 |
+
Built with β€οΈ by Eng. Jobbers β Qtrinova Inc
|
169 |
+
</a>
|
170 |
+
</div>""",
|
171 |
+
elem_id="footer"
|
172 |
+
)
|
173 |
+
|
174 |
+
demo.launch()
|