papasega commited on
Commit
a7bc78c
1 Parent(s): ed59b1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
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