Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,9 +49,16 @@ speech_to_text = pipeline("text-to-audio", model="facebook/musicgen-small")
|
|
49 |
|
50 |
# Function to transcribe audio to text
|
51 |
def transcribe_audio(audio_file, destination_language):
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
return translate_text(transcription, destination_language)
|
54 |
|
|
|
55 |
# Gradio interface
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("# AI-Powered Language Translation Bot")
|
|
|
49 |
|
50 |
# Function to transcribe audio to text
|
51 |
def transcribe_audio(audio_file, destination_language):
|
52 |
+
transcription_result = speech_to_text(audio_file)
|
53 |
+
print(f"Transcription result: {transcription_result}") # Print the whole response to inspect
|
54 |
+
if "text" in transcription_result:
|
55 |
+
transcription = transcription_result["text"]
|
56 |
+
else:
|
57 |
+
return "Error: Unable to transcribe audio."
|
58 |
+
|
59 |
return translate_text(transcription, destination_language)
|
60 |
|
61 |
+
|
62 |
# Gradio interface
|
63 |
with gr.Blocks() as demo:
|
64 |
gr.Markdown("# AI-Powered Language Translation Bot")
|