File size: 988 Bytes
618271d
835ff6c
 
 
618271d
835ff6c
848785c
 
 
 
835ff6c
 
848785c
 
835ff6c
848785c
4ec177a
f8bac98
848785c
 
835ff6c
848785c
835ff6c
848785c
835ff6c
838d7bb
848785c
618271d
 
848785c
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

import gradio as gr
from processing import transcribe_translate_speak
import tempfile

def process(audio_file, language):
    with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp:
        tmp.write(audio_file.read())
        tmp_path = tmp.name

    transcription, translation, audio_output = transcribe_translate_speak(tmp_path, language)
    return transcription, translation, audio_output

iface = gr.Interface(
    fn=process,
    inputs=[
        gr.Audio(type="filepath", label="Upload or Record Audio"),
        gr.Dropdown(["hin", "es", "fr", "bangla"], label="Translate To")
    ],
    outputs=[
        gr.Textbox(label="Transcribed Text"),
        gr.Textbox(label="Translated Text"),
        gr.Audio(label="Translated Audio")
    ],
    title="🎙️ SpeechSync - Python Edition",
    description="Record your voice in English, and this app will transcribe, translate, and speak it in your chosen language."
)

if __name__ == "__main__":
    iface.launch()