JanviMl commited on
Commit
5a980db
·
verified ·
1 Parent(s): 685f359

Update paraphraser.py

Browse files
Files changed (1) hide show
  1. paraphraser.py +3 -0
paraphraser.py CHANGED
@@ -42,6 +42,9 @@ def paraphrase_comment(comment):
42
  paraphrased_comment = tokenizer.decode(outputs[0], skip_special_tokens=True)
43
  # Remove the prompt part from the output
44
  paraphrased_comment = paraphrased_comment.replace(prompt, "").strip()
 
 
 
45
  return paraphrased_comment
46
 
47
  except Exception as e:
 
42
  paraphrased_comment = tokenizer.decode(outputs[0], skip_special_tokens=True)
43
  # Remove the prompt part from the output
44
  paraphrased_comment = paraphrased_comment.replace(prompt, "").strip()
45
+ # Remove unwanted prefixes like "Neutral: "
46
+ if paraphrased_comment.startswith("Neutral: "):
47
+ paraphrased_comment = paraphrased_comment[len("Neutral: "):].strip()
48
  return paraphrased_comment
49
 
50
  except Exception as e: