ombhojane commited on
Commit
da84324
·
1 Parent(s): 3b1ad93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -6
app.py CHANGED
@@ -316,6 +316,24 @@ if press_me_button:
316
  "human": "Human-Written"
317
  }
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
320
  with st.expander("Prediction Details (Click Here)..."):
321
  st.write(f"Ridge: {ridge_name}")
@@ -328,8 +346,7 @@ if press_me_button:
328
  st.write(f"{display_name}: {prob * 100:.2f}%")
329
  st.progress(float(prob))
330
 
331
- max_cnn_prob_name = sorted_probabilities[0][0]
332
- max_cnn_prob = float(sorted_probabilities[0][1])
333
 
334
  if word_count < 10.0 or word_count > 1081.0:
335
  st.warning("For better prediction input texts between 10 and 1081", icon="ℹ️")
@@ -376,7 +393,6 @@ if press_me_button:
376
  st.success(f"2- **{cnn_name}**", icon="✅")
377
  st.success(f"3- **{extra_trees_name}**", icon="✅")
378
 
379
-
380
 
381
 
382
  # Using expander to make FAQ sections
@@ -433,6 +449,3 @@ with st.expander("Can I use this as evidence?"):
433
  """)
434
 
435
 
436
-
437
-
438
-
 
316
  "human": "Human-Written"
317
  }
318
 
319
+
320
+ max_cnn_prob_name = sorted_probabilities[0][0]
321
+ max_cnn_prob = float(sorted_probabilities[0][1])
322
+
323
+ def classify_human_or_ai(ridge_prob, extra_trees_prob, cnn_prob):
324
+ threshold = 0.5 # You can adjust this threshold as needed
325
+ if max(ridge_prob, extra_trees_prob, cnn_prob) < threshold:
326
+ return "Human-Written"
327
+ else:
328
+ return "AI Generated"
329
+
330
+ # Determine the classification
331
+ classification = classify_human_or_ai(max_cnn_prob, max(ridge_prediction), max(extra_trees_prediction))
332
+
333
+ # Display the classification result
334
+ with st.expander("Classification Result"):
335
+ st.write(f"The input text is classified as: **{classification}**")
336
+
337
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
338
  with st.expander("Prediction Details (Click Here)..."):
339
  st.write(f"Ridge: {ridge_name}")
 
346
  st.write(f"{display_name}: {prob * 100:.2f}%")
347
  st.progress(float(prob))
348
 
349
+
 
350
 
351
  if word_count < 10.0 or word_count > 1081.0:
352
  st.warning("For better prediction input texts between 10 and 1081", icon="ℹ️")
 
393
  st.success(f"2- **{cnn_name}**", icon="✅")
394
  st.success(f"3- **{extra_trees_name}**", icon="✅")
395
 
 
396
 
397
 
398
  # Using expander to make FAQ sections
 
449
  """)
450
 
451