Zelyanoth commited on
Commit
dbcc3a3
·
1 Parent(s): 2b50d42
Files changed (2) hide show
  1. ai_functions.py +1 -1
  2. app.py +8 -8
ai_functions.py CHANGED
@@ -157,4 +157,4 @@ class MONDJEMIN_AI(object) :
157
  **inputs, forced_bos_token_id=tokenizer.lang_code_to_id["fra_Latn"],
158
  )
159
  lop.append(tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0])
160
- return ' '.join(lop)
 
157
  **inputs, forced_bos_token_id=tokenizer.lang_code_to_id["fra_Latn"],
158
  )
159
  lop.append(tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0])
160
+ return ' \n'.join(lop)
app.py CHANGED
@@ -4,22 +4,22 @@ import os
4
  from typing import Union
5
  from ai_functions import MONDJEMIN_AI # Assurez-vous que ce module est correctement importé et accessible
6
 
7
- def segment_sentence(sentence, word_limit):
8
- words = sentence.split()
9
- segments = []
10
 
11
- for i in range(0, len(words), word_limit):
12
- segment = ' '.join(words[i:i + word_limit])
13
- segments.append(segment)
14
 
15
- return segments
16
 
17
  def process_audio(file):
18
 
19
  ai = MONDJEMIN_AI(file)
20
  source_sentence = ai.transcriptor()
21
 
22
- sentences = segment_sentence(source_sentence, 15)
23
  traduction = ai.translate(sentences)
24
 
25
  return source_sentence, traduction
 
4
  from typing import Union
5
  from ai_functions import MONDJEMIN_AI # Assurez-vous que ce module est correctement importé et accessible
6
 
7
+ # def segment_sentence(sentence, word_limit):
8
+ # words = sentence.split()
9
+ # segments = []
10
 
11
+ # for i in range(0, len(words), word_limit):
12
+ # segment = ' '.join(words[i:i + word_limit])
13
+ # segments.append(segment)
14
 
15
+ # return segments
16
 
17
  def process_audio(file):
18
 
19
  ai = MONDJEMIN_AI(file)
20
  source_sentence = ai.transcriptor()
21
 
22
+ sentences = source_sentence.split(',')
23
  traduction = ai.translate(sentences)
24
 
25
  return source_sentence, traduction