Detsutut commited on
Commit
86794d4
1 Parent(s): 1fbda48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -52,8 +52,12 @@ def generate_text(input_text, max_new_tokens=512, temperature=1, system_prompt="
52
  )
53
  generated_text = output[0]['generated_text']
54
 
55
- if generated_text[-1] not in [".","!","?","\n"]:
56
  generated_text = generated_text + " [...]"
 
 
 
 
57
 
58
  return f"<span>{input_text}</span><b style='color: blue;'>{generated_text}</b>"
59
 
 
52
  )
53
  generated_text = output[0]['generated_text']
54
 
55
+ if generated_text[-1] not in [".","!","?","\n"] and generated_text[-4:-1] != "</s>:
56
  generated_text = generated_text + " [...]"
57
+
58
+ split_tentative = generated_text.split("### Risposta:")
59
+ if len(split_tentative) > 1:
60
+ generated_text = split_tentative[1]
61
 
62
  return f"<span>{input_text}</span><b style='color: blue;'>{generated_text}</b>"
63