ombhojane commited on
Commit
5a31eb6
·
1 Parent(s): da84324

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -322,14 +322,15 @@ if press_me_button:
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}**")
@@ -351,6 +352,10 @@ if press_me_button:
351
  if word_count < 10.0 or word_count > 1081.0:
352
  st.warning("For better prediction input texts between 10 and 1081", icon="ℹ️")
353
 
 
 
 
 
354
  elif word_count < 256:
355
  if ridge_prediction == extra_trees_prediction == predicted_author:
356
  st.success(f"Most likely written by: **{cnn_name}**", icon="✅")
 
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
+ # Convert to float before comparison
326
+ if max(float(ridge_prob), float(extra_trees_prob), float(cnn_prob)) < threshold:
327
  return "Human-Written"
328
  else:
329
  return "AI Generated"
330
 
331
  # Determine the classification
332
  classification = classify_human_or_ai(max_cnn_prob, max(ridge_prediction), max(extra_trees_prediction))
333
+
334
  # Display the classification result
335
  with st.expander("Classification Result"):
336
  st.write(f"The input text is classified as: **{classification}**")
 
352
  if word_count < 10.0 or word_count > 1081.0:
353
  st.warning("For better prediction input texts between 10 and 1081", icon="ℹ️")
354
 
355
+ elif classification == "Human-Written":
356
+ st.success("The input text is classified as **Human-Written**.", icon="✅")
357
+ st.info("We are quite confident in the accuracy of this result.", icon="ℹ️")
358
+
359
  elif word_count < 256:
360
  if ridge_prediction == extra_trees_prediction == predicted_author:
361
  st.success(f"Most likely written by: **{cnn_name}**", icon="✅")