Sandiago21 commited on
Commit
da1cd32
·
verified ·
1 Parent(s): 3565ac8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -986,8 +986,8 @@ def transcribe_speech(filepath):
986
  filepath,
987
  max_new_tokens=256,
988
  generate_kwargs={
989
- "task": "translate",
990
- "language": "english",
991
  }, # update with the language you've fine-tuned on
992
  chunk_length_s=30,
993
  batch_size=8,
@@ -1012,6 +1012,10 @@ mic_transcribe = gr.Interface(
1012
 
1013
 
1014
 
 
 
 
 
1015
 
1016
 
1017
 
@@ -1029,8 +1033,9 @@ def answer_question(user_question):
1029
 
1030
  def answer_from_audio(audio):
1031
  text = transcribe_speech(audio)
1032
- # return answer_question(text)
1033
- return text
 
1034
 
1035
 
1036
  # --------------------------
 
986
  filepath,
987
  max_new_tokens=256,
988
  generate_kwargs={
989
+ "task": "transcribe",
990
+ "language": "greek",
991
  }, # update with the language you've fine-tuned on
992
  chunk_length_s=30,
993
  batch_size=8,
 
1012
 
1013
 
1014
 
1015
+ greek_translation_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-el-en")
1016
+
1017
+ def translate_from_greek_english(text):
1018
+ return greek_translation_pipe(text)[0]["translation_text"]
1019
 
1020
 
1021
 
 
1033
 
1034
  def answer_from_audio(audio):
1035
  text = transcribe_speech(audio)
1036
+ translated_text = translate_from_greek_english(text)
1037
+ # return answer_question(translated_text)
1038
+ return translated_text
1039
 
1040
 
1041
  # --------------------------