Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,7 @@ import numpy as np
|
|
33 |
setattr(httpcore, 'SyncHTTPTransport', object)
|
34 |
|
35 |
from googletrans import Translator
|
|
|
36 |
|
37 |
# Initialisation du modèle de transcription
|
38 |
transcriber = pipeline("automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-arabic")
|
@@ -52,6 +53,7 @@ def transcribe_and_translate(stream, new_chunk):
|
|
52 |
# Transcription du texte
|
53 |
transcription = transcriber({"sampling_rate": sr, "raw": stream})["text"]
|
54 |
# Traduction du texte transcrit
|
|
|
55 |
translation = translator.translate(transcription, src='ar', dest='fr').text
|
56 |
return stream, transcription, translation
|
57 |
|
|
|
33 |
setattr(httpcore, 'SyncHTTPTransport', object)
|
34 |
|
35 |
from googletrans import Translator
|
36 |
+
import time
|
37 |
|
38 |
# Initialisation du modèle de transcription
|
39 |
transcriber = pipeline("automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-arabic")
|
|
|
53 |
# Transcription du texte
|
54 |
transcription = transcriber({"sampling_rate": sr, "raw": stream})["text"]
|
55 |
# Traduction du texte transcrit
|
56 |
+
time.sleep(5)
|
57 |
translation = translator.translate(transcription, src='ar', dest='fr').text
|
58 |
return stream, transcription, translation
|
59 |
|