Spaces:
Runtime error
Runtime error
File size: 5,562 Bytes
44b8921 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
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.") |