jaifar530 commited on
Commit
0ac2f46
·
unverified ·
1 Parent(s): fac959e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -249,13 +249,6 @@ def predict_author(new_text, model, tokenizer, label_encoder):
249
 
250
  new_text = st.text_area("Input Your Text Here:")
251
 
252
- # repeated_text = ""
253
- # # Repeat the text twice with a space at the end of each iteration
254
- # for _ in range(5):
255
- # repeated_text += new_text + " "
256
-
257
- # new_text = repeated_text
258
-
259
  # Creates a button named 'Press me'
260
  press_me_button = st.button("Human or Robot?")
261
 
@@ -330,8 +323,9 @@ if press_me_button:
330
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
331
 
332
  if ridge_prediction == extra_trees_prediction == predicted_author:
333
- st.write(f"Most likely written by: {ridge_name}")
334
-
 
335
  else:
336
  # Repeat the text with a space at the end of each iteration
337
 
@@ -377,19 +371,24 @@ if press_me_button:
377
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
378
 
379
  if ridge_prediction == extra_trees_prediction == predicted_author:
380
- st.write(f"Most likely written by: {ridge_name}")
 
381
 
382
  elif ridge_prediction == extra_trees_prediction:
383
- st.write(f"Most likely written by: {ridge_name}")
384
- st.write(f"2nd Most likely written by: {cnn_name}")
 
385
 
386
  elif extra_trees_prediction == predicted_author:
387
- st.write(f"Most likely written by: {extra_trees_name}")
388
- st.write(f"2nd Most likely written by: {ridge_name}")
 
389
 
390
  elif ridge_prediction == predicted_author:
391
- st.write(f"Most likely written by: {ridge_name}")
392
- st.write(f"2nd Most likely written by: {extra_trees_name}")
 
 
393
 
394
  else:
395
  st.write("Difficult to predict this text, \nit might fill into one of the below:")
 
249
 
250
  new_text = st.text_area("Input Your Text Here:")
251
 
 
 
 
 
 
 
 
252
  # Creates a button named 'Press me'
253
  press_me_button = st.button("Human or Robot?")
254
 
 
323
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
324
 
325
  if ridge_prediction == extra_trees_prediction == predicted_author:
326
+ st.success(f"Most likely written by: {ridge_name}", icon="✅")
327
+ st.info("We are quite confident in the accuracy of this result.", icon="ℹ️")
328
+
329
  else:
330
  # Repeat the text with a space at the end of each iteration
331
 
 
371
  cnn_name, ridge_name, extra_trees_name = get_author_display_name(predicted_author, ridge_prediction, extra_trees_prediction)
372
 
373
  if ridge_prediction == extra_trees_prediction == predicted_author:
374
+ st.success(f"Most likely written by: {ridge_name}", icon="✅")
375
+ st.warning(f"The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
376
 
377
  elif ridge_prediction == extra_trees_prediction:
378
+ st.success(f"Most likely written by: {ridge_name}", icon="✅")
379
+ st.success(f"2nd Most likely written by: {cnn_name}", icon="✅")
380
+ st.warning(f"The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
381
 
382
  elif extra_trees_prediction == predicted_author:
383
+ st.success(f"Most likely written by: {extra_trees_name}", icon="✅")
384
+ st.success(f"2nd Most likely written by: {ridge_name}", icon="✅")
385
+ st.warning(f"The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
386
 
387
  elif ridge_prediction == predicted_author:
388
+ st.success(f"Most likely written by: {ridge_name}", icon="✅")
389
+ st.success(f"2nd Most likely written by: {extra_trees_name}", icon="✅")
390
+ st.warning(f"The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
391
+
392
 
393
  else:
394
  st.write("Difficult to predict this text, \nit might fill into one of the below:")