Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,38 @@
|
|
| 1 |
-
import google.generativeai as genai
|
| 2 |
import gradio as gr
|
| 3 |
-
import
|
| 4 |
-
import
|
| 5 |
-
import
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import assemblyai as aai
|
| 3 |
+
import google.generativeai as genai
|
| 4 |
+
from script import audioTranscribe
|
| 5 |
+
|
| 6 |
+
# app = gr.Interface(audioTranscribe,
|
| 7 |
+
# inputs=[gr.Audio(sources=["microphone"], type="filepath"),
|
| 8 |
+
# gr.Dropdown(["French","Spanish","German","Italian","Japanese"],
|
| 9 |
+
# label="Languages",
|
| 10 |
+
# multiselect=False,
|
| 11 |
+
# value="French",
|
| 12 |
+
# info="Translations")],
|
| 13 |
+
# outputs=[gr.Text(label="Transcription"),gr.Text(label="Translation")])
|
| 14 |
+
# app.launch(debug=True)
|
| 15 |
+
|
| 16 |
+
with gr.Blocks(theme = gr.themes.Soft()) as app:
|
| 17 |
+
gr.Markdown("<center><strong><h3>Audio Transcription & Translation</h3></strong></center>")
|
| 18 |
+
with gr.Column():
|
| 19 |
+
with gr.Row():
|
| 20 |
+
audio_file = gr.Audio(sources=["microphone"], type="filepath")
|
| 21 |
+
translation = gr.Radio(choices=["French","Spanish","German","Italian","Japanese","Portuguese","Igbo","Korean","Hindi","Yoruba","Dutch","Hausa","Polish","Swahili","Turkish"],
|
| 22 |
+
label="Select Translate-To Language",
|
| 23 |
+
value="French",
|
| 24 |
+
interactive=True)
|
| 25 |
+
with gr.Row():
|
| 26 |
+
btn = gr.Button("Transcribe & Translate")
|
| 27 |
+
clear_btn = gr.ClearButton(value="Clear")
|
| 28 |
+
with gr.Column():
|
| 29 |
+
gr.Markdown("<center><strong><h3>Transcription & Translation Output</h3></strong></center>")
|
| 30 |
+
with gr.Row():
|
| 31 |
+
transcription = gr.Text(label="Transcription")
|
| 32 |
+
translation_text = gr.Text(label="Translation")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
btn.click(audioTranscribe, inputs=[audio_file,translation], outputs=[transcription,translation_text])
|
| 36 |
+
clear_btn.click(lambda: (None, "French", "", ""), inputs=[], outputs=[audio_file, translation, transcription, translation_text], queue=False)
|
| 37 |
+
|
| 38 |
+
app.launch()
|