Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,15 +44,14 @@ def translate_text(text, destination_language):
|
|
44 |
return translation[0]["translation_text"]
|
45 |
|
46 |
# Initialize the speech-to-text pipeline (Whisper model)
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
)
|
52 |
|
53 |
# Function to transcribe audio to text
|
54 |
def transcribe_audio(audio_file, destination_language):
|
55 |
-
transcription =
|
56 |
return translate_text(transcription, destination_language)
|
57 |
|
58 |
# Gradio interface
|
|
|
44 |
return translation[0]["translation_text"]
|
45 |
|
46 |
# Initialize the speech-to-text pipeline (Whisper model)
|
47 |
+
# Use a pipeline as a high-level helper
|
48 |
+
from transformers import pipeline
|
49 |
+
|
50 |
+
pipe = pipeline("text-to-audio", model="facebook/musicgen-small")
|
|
|
51 |
|
52 |
# Function to transcribe audio to text
|
53 |
def transcribe_audio(audio_file, destination_language):
|
54 |
+
transcription = pipe(audio_file)["text"]
|
55 |
return translate_text(transcription, destination_language)
|
56 |
|
57 |
# Gradio interface
|