NoaiGPT commited on
Commit
170072f
1 Parent(s): b26218c
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -636,7 +636,7 @@ def generate_paraphrases(text, setting, output_format):
636
  temperature=temperature
637
  )
638
 
639
- paraphrases_texts = [paraphraser_tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True) for output in outputs]
640
 
641
  formatted_output += f"Original sentence {i+1}: {sentence}\n"
642
  for j, paraphrase in enumerate(paraphrases_texts, 1):
@@ -692,21 +692,20 @@ def generate_paraphrases(text, setting, output_format):
692
  else:
693
  return json.dumps(json_output, indent=2), "\n\n".join([v[0] for v in human_versions])
694
 
695
- def clean_paraphrased_output(text):
696
- cleaned_text = clean_text(text)
697
- return cleaned_text
698
-
699
  # Define the Gradio interface
700
  iface = gr.Interface(
701
- fn=clean_paraphrased_output,
702
  inputs=[
703
- gr.Textbox(lines=5, label="Input Text")
 
 
704
  ],
705
  outputs=[
706
- gr.Textbox(lines=20, label="Cleaned Text")
 
707
  ],
708
- title="Clean Paraphrased Output",
709
- description="Enter a text with 'paraphrasedoutput:' prefix and get the cleaned text."
710
  )
711
 
712
  # Launch the interface
 
636
  temperature=temperature
637
  )
638
 
639
+ paraphrases_texts = [clean_text(paraphraser_tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)) for output in outputs]
640
 
641
  formatted_output += f"Original sentence {i+1}: {sentence}\n"
642
  for j, paraphrase in enumerate(paraphrases_texts, 1):
 
692
  else:
693
  return json.dumps(json_output, indent=2), "\n\n".join([v[0] for v in human_versions])
694
 
 
 
 
 
695
  # Define the Gradio interface
696
  iface = gr.Interface(
697
+ fn=generate_paraphrases,
698
  inputs=[
699
+ gr.Textbox(lines=5, label="Input Text"),
700
+ gr.Slider(minimum=1, maximum=5, step=1, label="Readability to Human-like Setting"),
701
+ gr.Radio(["text", "json"], label="Output Format")
702
  ],
703
  outputs=[
704
+ gr.Textbox(lines=20, label="Detailed Paraphrases and Classifications"),
705
+ gr.Textbox(lines=10, label="Human-like or Less Confident Machine-generated Paraphrases")
706
  ],
707
+ title="Advanced Diverse Paraphraser with Human-like Filter",
708
+ description="Enter a text, select a setting from readable to human-like, and choose the output format to generate diverse paraphrased versions. Combined versions are classified, and those detected as human-produced or less confidently machine-generated are presented in the final output."
709
  )
710
 
711
  # Launch the interface