awacke1 commited on
Commit
e28349a
Β·
verified Β·
1 Parent(s): fec9c2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -211
app.py CHANGED
@@ -328,214 +328,4 @@ def main():
328
  st.experimental_rerun()
329
 
330
  if __name__ == "__main__":
331
- main()
332
-
333
-
334
-
335
- import streamlit as st
336
- import pandas as pd
337
- import numpy as np
338
- import time
339
- import random
340
-
341
- # Load famous quotes dataset
342
- @st.cache_data
343
- def load_famous_quotes():
344
- famous_quotes = [
345
- {"Number": 1, "Quote Topic": "Imagination", "Quote": "The true sign of intelligence is not knowledge but imagination. – Albert Einstein"},
346
- {"Number": 2, "Quote Topic": "Perseverance", "Quote": "I have not failed. I've just found 10,000 ways that won't work. – Thomas Edison"},
347
- {"Number": 3, "Quote Topic": "Innovation", "Quote": "Innovation distinguishes between a leader and a follower. – Steve Jobs"},
348
- {"Number": 4, "Quote Topic": "Research", "Quote": "Research is what I'm doing when I don't know what I'm doing. – Wernher von Braun"},
349
- {"Number": 5, "Quote Topic": "Possibility", "Quote": "The only way to discover the limits of the possible is to go beyond them into the impossible. – Arthur C. Clarke"},
350
- {"Number": 6, "Quote Topic": "Success", "Quote": "Success is a science; if you have the conditions, you get the result. – Oscar Wilde"},
351
- {"Number": 7, "Quote Topic": "Expertise", "Quote": "An expert is a person who has made all the mistakes that can be made in a very narrow field. – Niels Bohr"},
352
- {"Number": 8, "Quote Topic": "Curiosity", "Quote": "The important thing is to not stop questioning. Curiosity has its own reason for existing. – Albert Einstein"},
353
- {"Number": 9, "Quote Topic": "Future", "Quote": "The best way to predict the future is to invent it. – Alan Kay"},
354
- {"Number": 10, "Quote Topic": "Progress", "Quote": "If I have seen further it is by standing on the shoulders of Giants. – Isaac Newton"},
355
- {"Number": 11, "Quote Topic": "Logic and Imagination", "Quote": "Logic will get you from A to B. Imagination will take you everywhere. – Albert Einstein"},
356
- {"Number": 12, "Quote Topic": "Imagination", "Quote": "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world. – Albert Einstein"},
357
- {"Number": 13, "Quote Topic": "Science", "Quote": "Science is a way of thinking much more than it is a body of knowledge. – Carl Sagan"},
358
- {"Number": 14, "Quote Topic": "Problem Solving", "Quote": "We cannot solve our problems with the same thinking we used when we created them. – Albert Einstein"},
359
- {"Number": 15, "Quote Topic": "Experimentation", "Quote": "The true method of knowledge is experiment. – William Blake"},
360
- {"Number": 16, "Quote Topic": "Questions", "Quote": "The scientist is not a person who gives the right answers, he's one who asks the right questions. – Claude Levi-Strauss"},
361
- {"Number": 17, "Quote Topic": "Possibility", "Quote": "It's kind of fun to do the impossible. – Walt Disney"},
362
- {"Number": 18, "Quote Topic": "Technology", "Quote": "Any sufficiently advanced technology is indistinguishable from magic. – Arthur C. Clarke"},
363
- {"Number": 19, "Quote Topic": "Creativity", "Quote": "Creativity is intelligence having fun. – Albert Einstein"},
364
- {"Number": 20, "Quote Topic": "Invention", "Quote": "To invent, you need a good imagination and a pile of junk. – Thomas Edison"}
365
- ]
366
- return pd.DataFrame(famous_quotes)
367
-
368
- # Predefined custom quotes
369
- custom_quotes = [
370
- {"Number": 1, "Quote Topic": "Stages of Life 🌱", "Quote": "Every age unfolds a new lesson. Life's chapters evolve, each teaching us anew."},
371
- {"Number": 2, "Quote Topic": "Stages of Life 🌱", "Quote": "From infancy to twilight, our journey is painted in growth. Every stage shines with its own wisdom."},
372
- {"Number": 3, "Quote Topic": "Identity 🎭", "Quote": "We piece together our identity with experiences. In the vast cosmos, our ever-changing signature is our identity."},
373
- {"Number": 4, "Quote Topic": "Identity 🎭", "Quote": "We aren't born with a defined self. Our identity is an art, crafted through introspection and encounters."},
374
- {"Number": 5, "Quote Topic": "Enlightenment πŸ’‘", "Quote": "Every step towards enlightenment is a dive within. It's an ongoing journey of self and universe."},
375
- {"Number": 6, "Quote Topic": "Enlightenment πŸ’‘", "Quote": "True insight isn't just about knowledge. It's the harmony of mind, heart, and soul."},
376
- {"Number": 7, "Quote Topic": "Adaptive Resonance Theory 🧠", "Quote": "Our cognition is like a river, ever-flowing and adapting. Every experience shapes its course, forming new resonances."},
377
- {"Number": 8, "Quote Topic": "Adaptive Resonance Theory 🧠", "Quote": "The brain's capacity to learn is profound. It finds its rhythm in adaptive resonances."},
378
- {"Number": 9, "Quote Topic": "Panpsychism 🌌", "Quote": "The universe might hum with consciousness in every atom. Every speck could be part of this grand song."},
379
- {"Number": 10, "Quote Topic": "Panpsychism 🌌", "Quote": "What if consciousness isn't exclusive to us? The universe's shared melody might be sung by all."},
380
- {"Number": 11, "Quote Topic": "How to Think πŸ€”", "Quote": "Thinking isn't about arriving, it's about exploring. Dive deep, question, and embrace the universe within."},
381
- {"Number": 12, "Quote Topic": "How to Think πŸ€”", "Quote": "To think profoundly is to touch the cosmos. It's about connecting with the vastness and intricacies it holds."},
382
- {"Number": 13, "Quote Topic": "Plants Communication 🌿", "Quote": "In every leaf and root, plants tell tales of life. Their silent growth is a language we're just beginning to decipher."},
383
- {"Number": 14, "Quote Topic": "Plants Communication 🌿", "Quote": "Nature's every rustle is a whispered secret. It's a testament to the intricate web of communication."},
384
- {"Number": 15, "Quote Topic": "Fame 🌟", "Quote": "True impact outlives fleeting fame. What endures is the legacy we craft, not the applause we receive."},
385
- {"Number": 16, "Quote Topic": "Fame 🌟", "Quote": "Fame might shine bright, but it's transient. Genuine influence is the silent footprint we leave in time."},
386
- {"Number": 17, "Quote Topic": "Happiness 😊", "Quote": "True happiness is an inner light that shines brightest in shared moments."},
387
- {"Number": 18, "Quote Topic": "Happiness 😊", "Quote": "Life's riches aren't material but the joyous moments and heartfelt memories we gather."},
388
- {"Number": 19, "Quote Topic": "Exercise πŸƒ", "Quote": "Exercise is the symphony of the body, resonating with health and vitality."},
389
- {"Number": 20, "Quote Topic": "Exercise πŸƒ", "Quote": "In movement, we find balance, strength, and a celebration of life's potential."},
390
- {"Number": 21, "Quote Topic": "Good Habits πŸ”„", "Quote": "Good habits are the bricks that build the mansion of success."},
391
- {"Number": 22, "Quote Topic": "Good Habits πŸ”„", "Quote": "Consistency in habits crafts our destiny, one action at a time."},
392
- {"Number": 23, "Quote Topic": "Discipline πŸ•°οΈ", "Quote": "Discipline is the bridge between dreams and their realization."},
393
- {"Number": 24, "Quote Topic": "Discipline πŸ•°οΈ", "Quote": "Through discipline, chaos transforms into order, and aspirations into achievements."},
394
- {"Number": 25, "Quote Topic": "Stamina πŸš€", "Quote": "Stamina isn't just enduring but thriving amidst challenges."},
395
- {"Number": 26, "Quote Topic": "Stamina πŸš€", "Quote": "It's stamina that turns obstacles into stepping stones, fueling our journey forward."},
396
- {"Number": 27, "Quote Topic": "Artificial General Intelligence 🀯", "Quote": "AGI is not just about mimicking humans but understanding the core of intelligence itself."},
397
- {"Number": 28, "Quote Topic": "Artificial General Intelligence 🀯", "Quote": "The pursuit of AGI is a testament to humanity's quest to transcend its own boundaries."},
398
- {"Number": 29, "Quote Topic": "AI Pipelines πŸ› οΈ", "Quote": "AI pipelines are the arteries of intelligent systems, directing the flow of knowledge."},
399
- {"Number": 30, "Quote Topic": "AI Pipelines πŸ› οΈ", "Quote": "In well-crafted pipelines, AI finds its rhythm, efficiency, and transformative power."},
400
- {"Number": 31, "Quote Topic": "Genius 🌟", "Quote": "Genius isn't just raw talent; it's the alchemy of persistence, passion, and perspective."},
401
- {"Number": 32, "Quote Topic": "Genius 🌟", "Quote": "Every spark of genius has been nurtured by curiosity and an insatiable thirst for knowledge."},
402
- {"Number": 33, "Quote Topic": "Our Brains 🧠", "Quote": "Our brain is the universe's masterpiece, a nexus of thoughts, dreams, and memories."},
403
- {"Number": 34, "Quote Topic": "Our Brains 🧠", "Quote": "In every neuron, our brain holds the potential of countless possibilities and imaginations."},
404
- {"Number": 35, "Quote Topic": "Our Brains 🧠", "Quote": "The intricacies of our brain reflect the cosmos: vast, complex, and beautifully mysterious."},
405
- {"Number": 36, "Quote Topic": "Our Brains 🧠", "Quote": "Understanding our brain is the key to unlocking the enigmas of consciousness, behavior, and potential."},
406
- {"Number": 37, "Quote Topic": "Mindfulness 🌼", "Quote": "Mindfulness is the anchor that grounds us in the present, amidst life's tumultuous seas."},
407
- {"Number": 38, "Quote Topic": "Mindfulness 🌼", "Quote": "In the act of being mindful, we embrace life's symphony, note by note, moment by moment."},
408
- {"Number": 39, "Quote Topic": "Resilience πŸ’ͺ", "Quote": "Resilience is the art of bouncing back, turning wounds into wisdom and setbacks into comebacks."},
409
- {"Number": 40, "Quote Topic": "Resilience πŸ’ͺ", "Quote": "Life will test us, but with resilience, we rise, stronger and more enlightened."},
410
- {"Number": 41, "Quote Topic": "Innovation πŸ’‘", "Quote": "Innovation is the heartbeat of progress, pushing boundaries and redefining possibilities."},
411
- {"Number": 42, "Quote Topic": "Innovation πŸ’‘", "Quote": "Every breakthrough, every invention, is a testament to humanity's relentless spirit of innovation."},
412
- {"Number": 43, "Quote Topic": "Empathy ❀️", "Quote": "Empathy is the bridge between souls, transcending words and touching hearts."},
413
- {"Number": 44, "Quote Topic": "Empathy ❀️", "Quote": "Through empathy, we see the world through another's eyes, fostering understanding and unity."},
414
- {"Number": 45, "Quote Topic": "Happiness 😊", "Quote": "True happiness is an inner light that shines brightest in shared moments."},
415
- {"Number": 46, "Quote Topic": "Happiness 😊", "Quote": "Life's riches aren't material but the joyous moments and heartfelt memories we gather."},
416
- {"Number": 47, "Quote Topic": "Exercise πŸƒ", "Quote": "Exercise is the symphony of the body, resonating with health and vitality."},
417
- {"Number": 48, "Quote Topic": "Exercise πŸƒ", "Quote": "In movement, we find balance, strength, and a celebration of life's potential."},
418
- {"Number": 49, "Quote Topic": "Good Habits πŸ”„", "Quote": "Good habits are the bricks that build the mansion of success."},
419
- {"Number": 50, "Quote Topic": "Good Habits πŸ”„", "Quote": "Consistency in habits crafts our destiny, one action at a time."},
420
- {"Number": 51, "Quote Topic": "Discipline πŸ•°οΈ", "Quote": "Discipline is the bridge between dreams and their realization."},
421
- {"Number": 52, "Quote Topic": "Discipline πŸ•°οΈ", "Quote": "Through discipline, chaos transforms into order, and aspirations into achievements."},
422
- {"Number": 53, "Quote Topic": "Stamina πŸš€", "Quote": "Stamina isn't just enduring but thriving amidst challenges."},
423
- {"Number": 54, "Quote Topic": "Stamina πŸš€", "Quote": "It's stamina that turns obstacles into stepping stones, fueling our journey forward."},
424
- {"Number": 55, "Quote Topic": "Artificial General Intelligence 🀯", "Quote": "AGI is not just about mimicking humans but understanding the core of intelligence itself."},
425
- {"Number": 56, "Quote Topic": "Artificial General Intelligence 🀯", "Quote": "The pursuit of AGI is a testament to humanity's quest to transcend its own boundaries."},
426
- {"Number": 57, "Quote Topic": "AI Pipelines πŸ› οΈ", "Quote": "AI pipelines are the arteries of intelligent systems, directing the flow of knowledge."},
427
- {"Number": 58, "Quote Topic": "AI Pipelines πŸ› οΈ", "Quote": "In well-crafted pipelines, AI finds its rhythm, efficiency, and transformative power."},
428
- {"Number": 59, "Quote Topic": "Genius 🌟", "Quote": "Genius isn't just raw talent; it's the alchemy of persistence, passion, and perspective."},
429
- {"Number": 60, "Quote Topic": "Genius 🌟", "Quote": "Every spark of genius has been nurtured by curiosity and an insatiable thirst for knowledge."},
430
- {"Number": 61, "Quote Topic": "Our Brains 🧠", "Quote": "Our brain is the universe's masterpiece, a nexus of thoughts, dreams, and memories."},
431
- {"Number": 62, "Quote Topic": "Our Brains 🧠", "Quote": "In every neuron, our brain holds the potential of countless possibilities and imaginations."},
432
- {"Number": 63, "Quote Topic": "Our Brains 🧠", "Quote": "The intricacies of our brain reflect the cosmos: vast, complex, and beautifully mysterious."},
433
- {"Number": 64, "Quote Topic": "Our Brains 🧠", "Quote": "Understanding our brain is the key to unlocking the enigmas of consciousness, behavior, and potential."},
434
- {"Number": 65, "Quote Topic": "Mindfulness 🌼", "Quote": "Mindfulness is the anchor that grounds us in the present, amidst life's tumultuous seas."},
435
- {"Number": 66, "Quote Topic": "Mindfulness 🌼", "Quote": "In the act of being mindful, we embrace life's symphony, note by note, moment by moment."},
436
- {"Number": 67, "Quote Topic": "Resilience πŸ’ͺ", "Quote": "Resilience is the art of bouncing back, turning wounds into wisdom and setbacks into comebacks."},
437
- {"Number": 68, "Quote Topic": "Resilience πŸ’ͺ", "Quote": "Life will test us, but with resilience, we rise, stronger and more enlightened."},
438
- {"Number": 69, "Quote Topic": "Innovation πŸ’‘", "Quote": "Innovation is the heartbeat of progress, pushing boundaries and redefining possibilities."},
439
- {"Number": 70, "Quote Topic": "Innovation πŸ’‘", "Quote": "Every breakthrough, every invention, is a testament to humanity's relentless spirit of innovation."},
440
- {"Number": 71, "Quote Topic": "Empathy ❀️", "Quote": "Empathy is the bridge between souls, transcending words and touching hearts."},
441
- {"Number": 72, "Quote Topic": "Empathy ❀️", "Quote": "Through empathy, we see the world through another's eyes, fostering understanding and unity."},
442
- {"Number": 73, "Quote Topic": "Inspiration 🌈", "Quote": "Inspiration is the spark that ignites the soul, propelling us to chase our dreams."},
443
- {"Number": 74, "Quote Topic": "Inspiration 🌈", "Quote": "Every moment of inspiration is a call to action, pushing us beyond our boundaries."},
444
- {"Number": 75, "Quote Topic": "Learning πŸ“š", "Quote": "Learning is the gateway to growth, opening doors to endless possibilities."},
445
- {"Number": 76, "Quote Topic": "Learning πŸ“š", "Quote": "Every lesson learned is a step towards enlightenment, broadening our horizons."},
446
- {"Number": 77, "Quote Topic": "Collaboration 🀝", "Quote": "In collaboration, we find strength. Together, we achieve more than we could alone."},
447
- {"Number": 78, "Quote Topic": "Collaboration 🀝", "Quote": "Unity in purpose paves the way for monumental achievements, showcasing the power of collective effort."},
448
- {"Number": 79, "Quote Topic": "Dreams 🌌", "Quote": "Dreams are the architects of our future. They sketch the blueprint of our aspirations."},
449
- {"Number": 80, "Quote Topic": "Dreams 🌌", "Quote": "In dreams, we find hope, and with hope, we transform the fabric of reality."},
450
- {"Number": 81, "Quote Topic": "Courage 🦁", "Quote": "Courage is the fire that lights our path, even in the face of overwhelming odds."},
451
- {"Number": 82, "Quote Topic": "Courage 🦁", "Quote": "With courage in our hearts, we defy limitations and embrace the vastness of potential."},
452
- {"Number": 83, "Quote Topic": "Change πŸŒ€", "Quote": "Change is life's only constant. It shapes, molds, and propels us forward."},
453
- {"Number": 84, "Quote Topic": "Change πŸŒ€", "Quote": "Embracing change is embracing growth, an acknowledgment of life's ever-evolving nature."},
454
- {"Number": 85, "Quote Topic": "Adventure 🌍", "Quote": "Life is an adventure, filled with twists, turns, and unexpected discoveries."},
455
- {"Number": 86, "Quote Topic": "Adventure 🌍", "Quote": "Every adventure, big or small, adds a chapter to our story, enriching our experience."},
456
- {"Number": 87, "Quote Topic": "Creativity 🎨", "Quote": "Creativity is the dance of the soul, expressing itself in countless forms."},
457
- {"Number": 88, "Quote Topic": "Creativity 🎨", "Quote": "Through creativity, we paint the world in vibrant colors, showcasing our unique perspectives."},
458
- {"Number": 89, "Quote Topic": "Passion ❀️", "Quote": "Passion is the fuel for our journey, driving us to chase after our dreams."},
459
- {"Number": 90, "Quote Topic": "Passion ❀️", "Quote": "With passion, every task becomes a labor of love, and every challenge, a thrilling endeavor."},
460
- {"Number": 91, "Quote Topic": "Hope 🌟", "Quote": "Hope is the beacon that guides us through stormy nights, reminding us of the dawn that awaits."},
461
- {"Number": 92, "Quote Topic": "Hope 🌟", "Quote": "In hope, we find solace, and in its embrace, we find the strength to persevere."},
462
- {"Number": 93, "Quote Topic": "Intuition 🧭", "Quote": "Intuition is the silent whisper of the soul, guiding us with its subtle wisdom."},
463
- {"Number": 94, "Quote Topic": "Intuition 🧭", "Quote": "By tuning into our intuition, we align with our inner compass, navigating life with clarity."},
464
- {"Number": 95, "Quote Topic": "Joy πŸ˜ƒ", "Quote": "Joy is the melody of the heart, a song of gratitude and love."},
465
- {"Number": 96, "Quote Topic": "Joy πŸ˜ƒ", "Quote": "In moments of joy, we connect with the essence of life, celebrating its beauty."},
466
- {"Number": 97, "Quote Topic": "Wisdom πŸ¦‰", "Quote": "Wisdom is the culmination of experience, a treasure trove of insights and reflections."},
467
- {"Number": 98, "Quote Topic": "Wisdom πŸ¦‰", "Quote": "With wisdom, we navigate life's complexities, drawing from the lessons of the past."},
468
- {"Number": 99, "Quote Topic": "Love ❀️", "Quote": "Love is the universal language, transcending boundaries and touching souls."},
469
- {"Number": 100, "Quote Topic": "Love ❀️", "Quote": "Through love, we find connection, unity, and the essence of existence."}
470
- ]
471
-
472
- # Function to display quotes
473
- def display_quotes(quotes_df):
474
- st.table(quotes_df[['Quote Topic', 'Quote']])
475
-
476
- # Main app function
477
- def main():
478
- st.title("πŸ“ Super Quote Generator")
479
- st.write("Welcome to the Super Quote Generator! Enjoy famous and custom quotes with advanced features.")
480
-
481
- # Initialize session states
482
- if 'auto_repeat' not in st.session_state:
483
- st.session_state.auto_repeat = False
484
- if 'data_source' not in st.session_state:
485
- st.session_state.data_source = 'Famous Quotes'
486
- if 'num_quotes' not in st.session_state:
487
- st.session_state.num_quotes = 10
488
- if 'quotes_df' not in st.session_state:
489
- st.session_state.quotes_df = pd.DataFrame()
490
-
491
- # Sidebar configuration
492
- with st.sidebar:
493
- st.header("Settings")
494
- # Data source selection
495
- st.session_state.data_source = st.radio("Select Quote Source:", ['Famous Quotes', 'Custom Quotes'])
496
- # Number of quotes to display
497
- st.session_state.num_quotes = st.slider("Number of Quotes:", 1, 20, 10)
498
- # AutoRepeat toggle
499
- st.session_state.auto_repeat = st.checkbox("AutoRepeat", value=False)
500
- # Regenerate quotes button
501
- if st.button('πŸ”„ Regenerate Quotes'):
502
- regenerate_quotes()
503
- st.markdown("---")
504
- st.write("Famous quotes provided by the app.")
505
-
506
- # Function to regenerate quotes
507
- def regenerate_quotes():
508
- if st.session_state.data_source == 'Famous Quotes':
509
- quotes_data = load_famous_quotes()
510
- random_quotes = quotes_data.sample(n=st.session_state.num_quotes)
511
- st.session_state.quotes_df = random_quotes.reset_index(drop=True)
512
- else:
513
- random_quotes = random.sample(custom_quotes, st.session_state.num_quotes)
514
- st.session_state.quotes_df = pd.DataFrame(random_quotes)
515
-
516
- # Initial load of quotes
517
- if st.session_state.quotes_df.empty:
518
- regenerate_quotes()
519
-
520
- # Display quotes
521
- quote_placeholder = st.empty()
522
- with quote_placeholder.container():
523
- display_quotes(st.session_state.quotes_df)
524
-
525
- # AutoRepeat functionality
526
- if st.session_state.auto_repeat:
527
- interval = st.slider("AutoRepeat Interval (seconds):", 5, 30, 10)
528
- while st.session_state.auto_repeat:
529
- time.sleep(interval)
530
- regenerate_quotes()
531
- with quote_placeholder.container():
532
- display_quotes(st.session_state.quotes_df)
533
- st.experimental_rerun()
534
-
535
- if __name__ == "__main__":
536
- main()
537
-
538
-
539
-
540
-
541
-
 
328
  st.experimental_rerun()
329
 
330
  if __name__ == "__main__":
331
+ main()