jaifar530 commited on
Commit
d38cd87
Β·
unverified Β·
1 Parent(s): beddc8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -37
app.py CHANGED
@@ -12,7 +12,45 @@ import numpy as np
12
  from PIL import Image
13
  from joblib import load
14
  import math
15
- from streamlit_extras.let_it_rain import rain
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
 
18
 
@@ -325,12 +363,12 @@ if press_me_button:
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
- rain(
329
- emoji="πŸ˜ƒ",
330
- font_size=54,
331
- falling_speed=5,
332
- animation_length="infinite",
333
- )
334
 
335
  else:
336
  # Repeat the text with a space at the end of each iteration
@@ -380,48 +418,48 @@ if press_me_button:
380
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
381
  st.warning(f"**Notice:** Your input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
382
  st.write("_" * 30)
383
- rain(
384
- emoji="πŸ˜ƒ",
385
- font_size=54,
386
- falling_speed=5,
387
- animation_length="infinite",
388
- )
389
 
390
  elif ridge_prediction == extra_trees_prediction:
391
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
392
  st.success(f"2nd Most likely written by: **{cnn_name}**", icon="βœ…")
393
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
394
  st.write("_" * 30)
395
- rain(
396
- emoji="😐",
397
- font_size=54,
398
- falling_speed=5,
399
- animation_length="infinite",
400
- )
401
 
402
  elif extra_trees_prediction == predicted_author:
403
  st.success(f"Most likely written by: **{extra_trees_name}**", icon="βœ…")
404
  st.success(f"2nd Most likely written by: **{ridge_name}**", icon="βœ…")
405
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
406
  st.write("_" * 30)
407
- rain(
408
- emoji="😐",
409
- font_size=54,
410
- falling_speed=5,
411
- animation_length="infinite",
412
- )
413
 
414
  elif ridge_prediction == predicted_author:
415
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
416
  st.success(f"2nd Most likely written by: **{extra_trees_name}**", icon="βœ…")
417
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
418
  st.write("_" * 30)
419
- rain(
420
- emoji="😐",
421
- font_size=54,
422
- falling_speed=5,
423
- animation_length="infinite",
424
- )
425
 
426
 
427
  else:
@@ -431,12 +469,12 @@ if press_me_button:
431
  st.success(f"3- **{extra_trees_name}**", icon="βœ…")
432
  st.warning(f"**Notice 2:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
433
  st.write("_" * 30)
434
- rain(
435
- emoji="πŸ˜•",
436
- font_size=54,
437
- falling_speed=5,
438
- animation_length="infinite",
439
- )
440
 
441
 
442
  # with st.expander("What is this project about?"):
 
12
  from PIL import Image
13
  from joblib import load
14
  import math
15
+ import streamlit as st
16
+
17
+ st.title("Rain Emojis")
18
+
19
+ # Custom HTML and JavaScript for falling emojis
20
+ st.markdown(
21
+ """
22
+ <style>
23
+ .emoji {
24
+ position: fixed;
25
+ font-size: 54px;
26
+ }
27
+ </style>
28
+ <div id="emoji-container"></div>
29
+ <script>
30
+ function makeEmojiFall() {
31
+ var emoji = document.createElement("div");
32
+ emoji.className = "emoji";
33
+ emoji.innerText = "🎈";
34
+ document.getElementById("emoji-container").appendChild(emoji);
35
+ emoji.style.left = Math.random() * window.innerWidth + "px";
36
+ emoji.style.animationDuration = Math.random() * 5 + 3 + "s";
37
+ emoji.style.animationName = "fall";
38
+ }
39
+ setInterval(makeEmojiFall, 1000);
40
+ </script>
41
+ <style>
42
+ @keyframes fall {
43
+ from {
44
+ top: -100px;
45
+ }
46
+ to {
47
+ top: 100vh;
48
+ }
49
+ }
50
+ </style>
51
+ """,
52
+ unsafe_allow_html=True,
53
+ )
54
 
55
 
56
 
 
363
  if ridge_prediction == extra_trees_prediction == predicted_author:
364
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
365
  st.info("We are quite confident in the accuracy of this result.", icon="ℹ️")
366
+ # rain(
367
+ # emoji="πŸ˜ƒ",
368
+ # font_size=54,
369
+ # falling_speed=5,
370
+ # animation_length="infinite",
371
+ # )
372
 
373
  else:
374
  # Repeat the text with a space at the end of each iteration
 
418
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
419
  st.warning(f"**Notice:** Your input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
420
  st.write("_" * 30)
421
+ # rain(
422
+ # emoji="πŸ˜ƒ",
423
+ # font_size=54,
424
+ # falling_speed=5,
425
+ # animation_length="infinite",
426
+ # )
427
 
428
  elif ridge_prediction == extra_trees_prediction:
429
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
430
  st.success(f"2nd Most likely written by: **{cnn_name}**", icon="βœ…")
431
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
432
  st.write("_" * 30)
433
+ # rain(
434
+ # emoji="😐",
435
+ # font_size=54,
436
+ # falling_speed=5,
437
+ # animation_length="infinite",
438
+ # )
439
 
440
  elif extra_trees_prediction == predicted_author:
441
  st.success(f"Most likely written by: **{extra_trees_name}**", icon="βœ…")
442
  st.success(f"2nd Most likely written by: **{ridge_name}**", icon="βœ…")
443
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
444
  st.write("_" * 30)
445
+ # rain(
446
+ # emoji="😐",
447
+ # font_size=54,
448
+ # falling_speed=5,
449
+ # animation_length="infinite",
450
+ # )
451
 
452
  elif ridge_prediction == predicted_author:
453
  st.success(f"Most likely written by: **{ridge_name}**", icon="βœ…")
454
  st.success(f"2nd Most likely written by: **{extra_trees_name}**", icon="βœ…")
455
  st.warning(f"**Notice:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
456
  st.write("_" * 30)
457
+ # rain(
458
+ # emoji="😐",
459
+ # font_size=54,
460
+ # falling_speed=5,
461
+ # animation_length="infinite",
462
+ # )
463
 
464
 
465
  else:
 
469
  st.success(f"3- **{extra_trees_name}**", icon="βœ…")
470
  st.warning(f"**Notice 2:** The input text has been magnified {amplify} times to better capture its characteristics and patterns.", icon="⚠️")
471
  st.write("_" * 30)
472
+ # rain(
473
+ # emoji="πŸ˜•",
474
+ # font_size=54,
475
+ # falling_speed=5,
476
+ # animation_length="infinite",
477
+ # )
478
 
479
 
480
  # with st.expander("What is this project about?"):