Demosthene-OR commited on
Commit
d3cbfff
·
1 Parent(s): 99c361b

Changement de traducteur en seq2seq

Browse files
requirements.txt CHANGED
@@ -24,7 +24,6 @@ sentencepiece==0.1.99
24
  openai-whisper==20231117
25
  sounddevice==0.4.6
26
  torch==2.2.0
27
- translate==3.6.1
28
  speechrecognition==3.10.1
29
  audio_recorder_streamlit==0.0.8
30
  whisper==1.1.10
 
24
  openai-whisper==20231117
25
  sounddevice==0.4.6
26
  torch==2.2.0
 
27
  speechrecognition==3.10.1
28
  audio_recorder_streamlit==0.0.8
29
  whisper==1.1.10
tabs/modelisation_seq2seq_tab.py CHANGED
@@ -4,7 +4,8 @@ import numpy as np
4
  import os
5
  from sacrebleu import corpus_bleu
6
  from transformers import pipeline
7
- from translate import Translator
 
8
  from audio_recorder_streamlit import audio_recorder
9
  import speech_recognition as sr
10
  import whisper
@@ -461,7 +462,8 @@ def run():
461
  with col2:
462
  st.write(":red[**Trad. Google Translate**]")
463
  try:
464
- translator = Translator(to_lang=l_tgt, from_lang=Lang_detected)
 
465
  if custom_sentence!="":
466
  translation = translator.translate(custom_sentence)
467
  st.write("**"+l_tgt+" :** "+translation)
@@ -518,7 +520,8 @@ def run():
518
  st.write("")
519
  st.write("**"+Lang_detected+" :** :blue["+custom_sentence+"]")
520
  st.write("")
521
- translator = Translator(to_lang=l_tgt, from_lang=Lang_detected)
 
522
  translation = translator.translate(custom_sentence)
523
  st.write("**"+l_tgt+" :** "+translation)
524
  st.write("")
 
4
  import os
5
  from sacrebleu import corpus_bleu
6
  from transformers import pipeline
7
+ # from translate import Translator
8
+ from deep_translator import GoogleTranslator
9
  from audio_recorder_streamlit import audio_recorder
10
  import speech_recognition as sr
11
  import whisper
 
462
  with col2:
463
  st.write(":red[**Trad. Google Translate**]")
464
  try:
465
+ # translator = Translator(to_lang=l_tgt, from_lang=Lang_detected)
466
+ translator = GoogleTranslator(source=Lang_detected, target=l_tgt)
467
  if custom_sentence!="":
468
  translation = translator.translate(custom_sentence)
469
  st.write("**"+l_tgt+" :** "+translation)
 
520
  st.write("")
521
  st.write("**"+Lang_detected+" :** :blue["+custom_sentence+"]")
522
  st.write("")
523
+ # translator = Translator(to_lang=l_tgt, from_lang=Lang_detected)
524
+ translator = GoogleTranslator(source=Lang_detected, target=l_tgt)
525
  translation = translator.translate(custom_sentence)
526
  st.write("**"+l_tgt+" :** "+translation)
527
  st.write("")