awacke1's picture
Create app.py
44b8921 verified
import streamlit as st
import random
# Define the personality factors and their descriptions
personality_factors = """
1. 🌈 Openness (Being open to new things)
- 🎭 Imagination (Enjoying fantasy and daydreaming)
- 🎨 Artistic Interests (Appreciating beauty and art)
- 🎸 Creativity (Coming up with new ideas)
- 🌍 Curiosity (Wanting to explore and learn)
- 🌿 Unconventional (Being different and unique)
- 🧩 Complexity (Enjoying deep thoughts and feelings)
- 🌌 Adventurousness (Seeking new experiences)
2. πŸ’Ό Conscientiousness (Being organized and reliable)
- 🎯 Competence (Feeling capable and effective)
- πŸ“Š Orderliness (Keeping things neat and tidy)
- πŸ“… Dutifulness (Following rules and doing what's right)
- πŸ† Achievement (Working hard to reach goals)
- πŸ§˜β€β™€οΈ Self-Discipline (Staying focused and in control)
- πŸ€” Thoughtfulness (Thinking before acting)
- πŸ•°οΈ Time Management (Using time wisely)
- 🧽 Perfectionism (Wanting things to be just right)
3. πŸŽ‰ Extraversion (Being outgoing and social)
- πŸ€— Friendliness (Being kind and welcoming)
- πŸ‘₯ Sociability (Enjoying being with others)
- πŸ—£οΈ Assertiveness (Speaking up and taking charge)
- ⚑ Energy (Being active and lively)
- 🎒 Excitement (Seeking thrills and fun)
- 😊 Cheerfulness (Feeling happy and positive)
- 🎀 Talkativeness (Enjoying conversation)
- 🌞 Enthusiasm (Showing excitement and interest)
4. 🀝 Agreeableness (Being kind and cooperative)
- 🀲 Trust (Believing in others' goodness)
- 🌿 Honesty (Being truthful and sincere)
- 🀝 Cooperation (Working well with others)
- 🌸 Helpfulness (Being generous and caring)
- πŸ•ŠοΈ Compliance (Following rules and respecting authority)
- πŸ™ Modesty (Being humble and down-to-earth)
- πŸ’• Empathy (Understanding others' feelings)
- πŸ«‚ Compassion (Caring about others' well-being)
5. πŸ˜” Neuroticism (Feeling negative emotions easily)
- 😰 Anxiety (Worrying and feeling nervous)
- 😑 Anger (Getting upset and frustrated)
- 😒 Sadness (Feeling down and unhappy)
- 😳 Self-Consciousness (Feeling shy and uneasy)
- 🎒 Impulsiveness (Acting without thinking)
- πŸƒ Vulnerability (Being easily hurt or upset)
- πŸŒͺ️ Moodiness (Having ups and downs in feelings)
- 🎭 Negativity (Focusing on the bad side of things)
"""
# Define the Entity class
class Entity:
def __init__(self, name, character_sheet, relationships):
self.name = name
self.character_sheet = character_sheet
self.relationships = relationships
self.events = []
def add_event(self, event):
self.events.append(event)
def update_relationship(self, other_entity, sentiment):
self.relationships[other_entity.name] += sentiment
# Define the entities
aaron = Entity("Aaron", "Adventurous, creative, and friendly", {"Trudy": 5, "Sam": 7})
trudy = Entity("Trudy", "Organized, assertive, and empathetic", {"Aaron": 6, "Sam": 4})
sam = Entity("Sam", "Curious, modest, and cooperative", {"Aaron": 8, "Trudy": 3})
entities = [aaron, trudy, sam]
# Define the event function
def add_event(event_description):
st.write("Event:", event_description)
for entity in entities:
sentiment = random.randint(-2, 2)
entity.add_event(event_description)
for other_entity in entities:
if entity != other_entity:
entity.update_relationship(other_entity, sentiment)
st.write(f"{entity.name}'s reaction: {sentiment}")
# Streamlit app
st.title("Entity Simulator")
st.markdown(personality_factors)
# Display character sheets
for entity in entities:
st.subheader(entity.name)
st.write("Character Sheet:", entity.character_sheet)
st.write("Relationships:")
for other_entity, sentiment in entity.relationships.items():
st.write(f"- {other_entity}: {sentiment}")
st.write("Events:")
for event in entity.events:
st.write(f"- {event}")
st.write("---")
# Add event
event_description = st.text_input("Enter an event:")
if st.button("Add Event"):
add_event(event_description)
# Answer questions
question = st.text_input("Ask a question:")
if st.button("Answer"):
# Example question and answer
if "wedding" in question.lower() and "weekend" in question.lower():
st.write("The wedding weekend was a joyous occasion. Aaron, being adventurous and friendly, thoroughly enjoyed meeting new people and celebrating with friends. Trudy, being organized and empathetic, made sure everything ran smoothly and offered support to the newlyweds. Sam, being curious and cooperative, engaged in heartfelt conversations and helped out wherever needed. Overall, it was a memorable weekend filled with love and laughter.")
elif "trudy" in question.lower() and "birthday" in question.lower() and "casino" in question.lower():
st.write("Trudy had an exciting birthday celebration at the casino. Being assertive and adventurous, she embraced the thrilling atmosphere and tried her luck at various games. Aaron, being creative and friendly, came up with unique ways to make the experience even more enjoyable for Trudy. Sam, being cooperative and empathetic, made sure Trudy felt loved and appreciated throughout the day. The trio had a fantastic time at the casino, creating lasting memories together.")
else:
st.write("I don't have enough information to answer that question.")