Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import pipeline
|
|
3 |
import numpy as np
|
4 |
import httpcore
|
5 |
from googletrans import Translator
|
|
|
6 |
|
7 |
# Correctif pour httpcore
|
8 |
setattr(httpcore, 'SyncHTTPTransport', object)
|
@@ -19,6 +20,7 @@ def transcribe_and_translate(audio):
|
|
19 |
|
20 |
# Transcription du texte
|
21 |
transcription = transcriber({"sampling_rate": sr, "raw": y})["text"]
|
|
|
22 |
# Traduction du texte transcrit
|
23 |
translation = translator.translate(transcription, src='ar', dest='fr').text
|
24 |
return transcription, translation
|
|
|
3 |
import numpy as np
|
4 |
import httpcore
|
5 |
from googletrans import Translator
|
6 |
+
import time
|
7 |
|
8 |
# Correctif pour httpcore
|
9 |
setattr(httpcore, 'SyncHTTPTransport', object)
|
|
|
20 |
|
21 |
# Transcription du texte
|
22 |
transcription = transcriber({"sampling_rate": sr, "raw": y})["text"]
|
23 |
+
time.sleep(2)
|
24 |
# Traduction du texte transcrit
|
25 |
translation = translator.translate(transcription, src='ar', dest='fr').text
|
26 |
return transcription, translation
|