Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
9 |
asr_pipe_audio2Text_Ge = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
10 |
asr_pipe_whisper = pipeline(task="automatic-speech-recognition", model="openai/whisper-base", device=device)
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
def translateAudio(audio_path):
|
17 |
translationOutput = asr_pipe_whisper(audio_path, max_new_tokens=256, generate_kwargs={"task":"translate"})
|
|
|
9 |
asr_pipe_audio2Text_Ge = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
10 |
asr_pipe_whisper = pipeline(task="automatic-speech-recognition", model="openai/whisper-base", device=device)
|
11 |
|
12 |
+
def transcribeFile(audio_path : str) -> str:
|
13 |
+
transcription = asr_pipe_audio2Text_Ge(audio_path)
|
14 |
+
return transcription["text"]
|
15 |
|
16 |
def translateAudio(audio_path):
|
17 |
translationOutput = asr_pipe_whisper(audio_path, max_new_tokens=256, generate_kwargs={"task":"translate"})
|