javi8979 commited on
Commit
2cbd116
·
verified ·
1 Parent(s): cc3e1ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -26,11 +26,16 @@ def generate_output(task, source, target, input_text, mt_text=None):
26
 
27
 
28
  sentences = input_text.split('\n')
29
- sentences = [s for s in sentences if len(s.strip()) > 0]
30
  generated_text = []
31
 
32
  for sentence in sentences:
33
  sentence = sentence.strip()
 
 
 
 
 
34
 
35
  if task == "Translation":
36
  prompt = f"Translate the following text from {source} into {target}.\n{source}: {sentence.strip()} \n{target}:"
 
26
 
27
 
28
  sentences = input_text.split('\n')
29
+ #sentences = [s for s in sentences if len(s.strip()) > 0]
30
  generated_text = []
31
 
32
  for sentence in sentences:
33
  sentence = sentence.strip()
34
+
35
+ if len(sentence) == 0:
36
+ # Preserve empty lines
37
+ generated_text.append('')
38
+ continue
39
 
40
  if task == "Translation":
41
  prompt = f"Translate the following text from {source} into {target}.\n{source}: {sentence.strip()} \n{target}:"