jaifar530 commited on
Commit
3d2c2a7
·
unverified ·
1 Parent(s): 16a4675

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -328,6 +328,8 @@ if press_me_button:
328
  st.progress(float(prob))
329
 
330
  st.write(f"Sorted probab: {sorted_probabilities[0][1] }")
 
 
331
  max_cnn_prob = float(sorted_probabilities[0][1])
332
 
333
 
@@ -413,6 +415,9 @@ if press_me_button:
413
  predicted_author, author_probabilities = predict_author(new_text, loaded_model, tokenizer, label_encoder)
414
  sorted_probabilities = sorted(author_probabilities.items(), key=lambda x: x[1], reverse=True)
415
 
 
 
 
416
  # Get disply name
417
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
418
  with st.expander("2nd iteration Details..."):
@@ -434,6 +439,16 @@ if press_me_button:
434
  # falling_speed=5,
435
  # animation_length="infinite",
436
  # )
 
 
 
 
 
 
 
 
 
 
437
 
438
  elif ridge_prediction == extra_trees_prediction:
439
  st.success(f"Most likely written by: **{ridge_name}**", icon="✅")
 
328
  st.progress(float(prob))
329
 
330
  st.write(f"Sorted probab: {sorted_probabilities[0][1] }")
331
+
332
+ max_cnn_prob_name = sorted_probabilities[0][0]
333
  max_cnn_prob = float(sorted_probabilities[0][1])
334
 
335
 
 
415
  predicted_author, author_probabilities = predict_author(new_text, loaded_model, tokenizer, label_encoder)
416
  sorted_probabilities = sorted(author_probabilities.items(), key=lambda x: x[1], reverse=True)
417
 
418
+ new_max_cnn_prob_name = sorted_probabilities[0][0]
419
+ new_max_cnn_prob = float(sorted_probabilities[0][1])
420
+
421
  # Get disply name
422
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
423
  with st.expander("2nd iteration Details..."):
 
439
  # falling_speed=5,
440
  # animation_length="infinite",
441
  # )
442
+ elif new_max_cnn_prob == max_cnn_prob and new_max_cnn_prob_name == max_cnn_prob_name:
443
+ st.success(f"Most likely written by: **{cnn_name}**", icon="✅")
444
+ st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
445
+ st.write("_" * 30)
446
+ # rain(
447
+ # emoji="😐",
448
+ # font_size=54,
449
+ # falling_speed=5,
450
+ # animation_length="infinite",
451
+ # )
452
 
453
  elif ridge_prediction == extra_trees_prediction:
454
  st.success(f"Most likely written by: **{ridge_name}**", icon="✅")