idkash1 commited on
Commit
926e64b
·
verified ·
1 Parent(s): de32c97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -39,8 +39,7 @@ def process_analysis(task_id, text, model_name, topic):
39
  return
40
 
41
  topic = check_topic(topic)
42
- hcRelativeToThreshold, df_sentences = detect_human_text(model_name, topic, text)
43
- message = 'Edits found in the text' if hcRelativeToThreshold >= 0 else 'We couldn\'t find edits in the text'
44
 
45
  sentences = [
46
  {
@@ -51,9 +50,15 @@ def process_analysis(task_id, text, model_name, topic):
51
  }
52
  for _, row in df_sentences.iterrows()
53
  ]
 
 
 
 
 
 
54
 
55
  # Store the result
56
- task_results[task_id] = {'status': 'completed', 'message': message, 'hcRelativeToThreshold': hcRelativeToThreshold, 'sentences': sentences}
57
 
58
  @app.route('/detectHumanInAIText/checkText', methods=['POST'])
59
  def check_text():
 
39
  return
40
 
41
  topic = check_topic(topic)
42
+ hcRelativeToThreshold, hc, df_sentences = detect_human_text(model_name, topic, text)
 
43
 
44
  sentences = [
45
  {
 
50
  }
51
  for _, row in df_sentences.iterrows()
52
  ]
53
+
54
+ foundPotentialEdits = [sentence for sentence in sentences if sentence['pvalue'] < 0.05]
55
+
56
+ message = f'We found {len(foundPotentialEdits)} potential edits in the text' if len(foundPotentialEdits) > 0 else 'We couldn\'t find edits in the text'
57
+
58
+
59
 
60
  # Store the result
61
+ task_results[task_id] = {'status': 'completed', 'message': message, 'hcRelativeToThreshold': hcRelativeToThreshold, 'HC': hc, 'sentences': sentences}
62
 
63
  @app.route('/detectHumanInAIText/checkText', methods=['POST'])
64
  def check_text():