awacke1 commited on
Commit
44b8921
β€’
1 Parent(s): de25e13

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +118 -0
app.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+
4
+ # Define the personality factors and their descriptions
5
+ personality_factors = """
6
+ 1. 🌈 Openness (Being open to new things)
7
+ - 🎭 Imagination (Enjoying fantasy and daydreaming)
8
+ - 🎨 Artistic Interests (Appreciating beauty and art)
9
+ - 🎸 Creativity (Coming up with new ideas)
10
+ - 🌍 Curiosity (Wanting to explore and learn)
11
+ - 🌿 Unconventional (Being different and unique)
12
+ - 🧩 Complexity (Enjoying deep thoughts and feelings)
13
+ - 🌌 Adventurousness (Seeking new experiences)
14
+
15
+ 2. πŸ’Ό Conscientiousness (Being organized and reliable)
16
+ - 🎯 Competence (Feeling capable and effective)
17
+ - πŸ“Š Orderliness (Keeping things neat and tidy)
18
+ - πŸ“… Dutifulness (Following rules and doing what's right)
19
+ - πŸ† Achievement (Working hard to reach goals)
20
+ - πŸ§˜β€β™€οΈ Self-Discipline (Staying focused and in control)
21
+ - πŸ€” Thoughtfulness (Thinking before acting)
22
+ - πŸ•°οΈ Time Management (Using time wisely)
23
+ - 🧽 Perfectionism (Wanting things to be just right)
24
+
25
+ 3. πŸŽ‰ Extraversion (Being outgoing and social)
26
+ - πŸ€— Friendliness (Being kind and welcoming)
27
+ - πŸ‘₯ Sociability (Enjoying being with others)
28
+ - πŸ—£οΈ Assertiveness (Speaking up and taking charge)
29
+ - ⚑ Energy (Being active and lively)
30
+ - 🎒 Excitement (Seeking thrills and fun)
31
+ - 😊 Cheerfulness (Feeling happy and positive)
32
+ - 🎀 Talkativeness (Enjoying conversation)
33
+ - 🌞 Enthusiasm (Showing excitement and interest)
34
+
35
+ 4. 🀝 Agreeableness (Being kind and cooperative)
36
+ - 🀲 Trust (Believing in others' goodness)
37
+ - 🌿 Honesty (Being truthful and sincere)
38
+ - 🀝 Cooperation (Working well with others)
39
+ - 🌸 Helpfulness (Being generous and caring)
40
+ - πŸ•ŠοΈ Compliance (Following rules and respecting authority)
41
+ - πŸ™ Modesty (Being humble and down-to-earth)
42
+ - πŸ’• Empathy (Understanding others' feelings)
43
+ - πŸ«‚ Compassion (Caring about others' well-being)
44
+
45
+ 5. πŸ˜” Neuroticism (Feeling negative emotions easily)
46
+ - 😰 Anxiety (Worrying and feeling nervous)
47
+ - 😑 Anger (Getting upset and frustrated)
48
+ - 😒 Sadness (Feeling down and unhappy)
49
+ - 😳 Self-Consciousness (Feeling shy and uneasy)
50
+ - 🎒 Impulsiveness (Acting without thinking)
51
+ - πŸƒ Vulnerability (Being easily hurt or upset)
52
+ - πŸŒͺ️ Moodiness (Having ups and downs in feelings)
53
+ - 🎭 Negativity (Focusing on the bad side of things)
54
+ """
55
+
56
+ # Define the Entity class
57
+ class Entity:
58
+ def __init__(self, name, character_sheet, relationships):
59
+ self.name = name
60
+ self.character_sheet = character_sheet
61
+ self.relationships = relationships
62
+ self.events = []
63
+
64
+ def add_event(self, event):
65
+ self.events.append(event)
66
+
67
+ def update_relationship(self, other_entity, sentiment):
68
+ self.relationships[other_entity.name] += sentiment
69
+
70
+ # Define the entities
71
+ aaron = Entity("Aaron", "Adventurous, creative, and friendly", {"Trudy": 5, "Sam": 7})
72
+ trudy = Entity("Trudy", "Organized, assertive, and empathetic", {"Aaron": 6, "Sam": 4})
73
+ sam = Entity("Sam", "Curious, modest, and cooperative", {"Aaron": 8, "Trudy": 3})
74
+
75
+ entities = [aaron, trudy, sam]
76
+
77
+ # Define the event function
78
+ def add_event(event_description):
79
+ st.write("Event:", event_description)
80
+ for entity in entities:
81
+ sentiment = random.randint(-2, 2)
82
+ entity.add_event(event_description)
83
+ for other_entity in entities:
84
+ if entity != other_entity:
85
+ entity.update_relationship(other_entity, sentiment)
86
+ st.write(f"{entity.name}'s reaction: {sentiment}")
87
+
88
+ # Streamlit app
89
+ st.title("Entity Simulator")
90
+ st.markdown(personality_factors)
91
+
92
+ # Display character sheets
93
+ for entity in entities:
94
+ st.subheader(entity.name)
95
+ st.write("Character Sheet:", entity.character_sheet)
96
+ st.write("Relationships:")
97
+ for other_entity, sentiment in entity.relationships.items():
98
+ st.write(f"- {other_entity}: {sentiment}")
99
+ st.write("Events:")
100
+ for event in entity.events:
101
+ st.write(f"- {event}")
102
+ st.write("---")
103
+
104
+ # Add event
105
+ event_description = st.text_input("Enter an event:")
106
+ if st.button("Add Event"):
107
+ add_event(event_description)
108
+
109
+ # Answer questions
110
+ question = st.text_input("Ask a question:")
111
+ if st.button("Answer"):
112
+ # Example question and answer
113
+ if "wedding" in question.lower() and "weekend" in question.lower():
114
+ 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.")
115
+ elif "trudy" in question.lower() and "birthday" in question.lower() and "casino" in question.lower():
116
+ 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.")
117
+ else:
118
+ st.write("I don't have enough information to answer that question.")