Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,38 +2,53 @@ import streamlit as st
|
|
2 |
from graphviz import Digraph
|
3 |
import json
|
4 |
import os
|
|
|
5 |
|
6 |
def create_amygdala_hijacking_graph():
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
votes = load_votes()
|
22 |
-
st.write("Upvotes:")
|
23 |
-
for term, count in votes['upvotes'].items():
|
24 |
-
st.write(f"{term}: {count}")
|
25 |
|
26 |
-
|
27 |
-
for term, count in votes['downvotes'].items():
|
28 |
-
st.write(f"{term}: {count}")
|
29 |
-
|
30 |
-
def main():
|
31 |
st.title("Amygdala Hijacking Visualization")
|
32 |
-
st.text("A simple graph model to represent amygdala hijacking in the brain.")
|
33 |
-
|
34 |
amygdala_hijacking_graph = create_amygdala_hijacking_graph()
|
35 |
st.graphviz_chart(amygdala_hijacking_graph)
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
terms = [
|
38 |
'π Sensory Input',
|
39 |
'π‘ Thalamus',
|
@@ -48,26 +63,7 @@ def main():
|
|
48 |
upvote_button = st.button(f"π Upvote {term}")
|
49 |
downvote_button = st.button(f"π Downvote {term}")
|
50 |
|
51 |
-
|
52 |
-
votes = load_votes()
|
53 |
-
|
54 |
-
if upvote_button:
|
55 |
-
if term not in votes['upvotes']:
|
56 |
-
votes['upvotes'][term] = 0
|
57 |
-
votes['upvotes'][term] += 1
|
58 |
-
elif downvote_button:
|
59 |
-
if term not in votes['downvotes']:
|
60 |
-
votes['downvotes'][term] = 0
|
61 |
-
votes['downvotes'][term] += 1
|
62 |
-
|
63 |
-
save_votes(votes)
|
64 |
-
|
65 |
-
display_votes()
|
66 |
|
67 |
if __name__ == "__main__":
|
68 |
main()
|
69 |
-
|
70 |
-
st.markdown("""
|
71 |
-
Explain amygdala hijacking using a graph model in streamlit python program using graphviz to represent levels or modes of thinking
|
72 |
-
Amygdala hijacking is a phenomenon where our emotional brain (amygdala) takes control over our rational brain (prefrontal cortex), leading to impulsive and irrational behavior. In this response, I'll guide you on how to create a Streamlit app with Graphviz to visualize the concept of amygdala hijacking using a graph model.
|
73 |
-
""")
|
|
|
2 |
from graphviz import Digraph
|
3 |
import json
|
4 |
import os
|
5 |
+
import pandas as pd
|
6 |
|
7 |
def create_amygdala_hijacking_graph():
|
8 |
+
g = Digraph('Amygdala_Hijacking', format='png')
|
9 |
+
g.attr(fontname="Helvetica,Arial,sans-serif")
|
10 |
+
g.attr('node', fontname="Helvetica,Arial,sans-serif")
|
11 |
+
g.attr('edge', fontname="Helvetica,Arial,sans-serif")
|
12 |
+
g.attr('graph', newrank='true', nodesep='0.3', ranksep='0.2', overlap='true', splines='false')
|
13 |
+
g.attr('node', fixedsize='false', fontsize='24', height='1', shape='box', style='filled,setlinewidth(5)', width='2.2', penwidth='3')
|
14 |
+
g.attr('edge', arrowhead='none', arrowsize='0.5', labelfontname="Ubuntu", weight='10', style='filled,setlinewidth(5)')
|
15 |
|
16 |
+
g.node('1', 'π Sensory Input', fillcolor='lightblue')
|
17 |
+
g.node('2', 'π‘ Thalamus', fillcolor='palegreen')
|
18 |
+
g.node('3', 'π΄ Amygdala', color='red', fillcolor='red', fontcolor='white')
|
19 |
+
g.node('4', 'π Hippocampus', fillcolor='lightyellow')
|
20 |
+
g.node('5', 'π‘ Prefrontal Cortex', fillcolor='lightpink')
|
21 |
+
g.node('6', 'π¬ Response', fillcolor='lightgray')
|
22 |
|
23 |
+
g.edge('1', '2', label='π Receives Signals')
|
24 |
+
g.edge('2', '3', label='β‘ Quick, Emotional Response')
|
25 |
+
g.edge('2', '4', label='π Sends Signals To')
|
26 |
+
g.edge('4', '5', label='π Relays Information')
|
27 |
+
g.edge('5', '3', label='π§ Rational Control (If Not Hijacked)')
|
28 |
+
g.edge('3', '6', label='π Generates Response')
|
29 |
|
30 |
+
return g
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
def display_graph():
|
|
|
|
|
|
|
|
|
33 |
st.title("Amygdala Hijacking Visualization")
|
|
|
|
|
34 |
amygdala_hijacking_graph = create_amygdala_hijacking_graph()
|
35 |
st.graphviz_chart(amygdala_hijacking_graph)
|
36 |
|
37 |
+
def display_table():
|
38 |
+
st.title("Fun Questions Table")
|
39 |
+
|
40 |
+
data = [
|
41 |
+
(1, "π", "How many cups of coffee do you need to function like a normal human being?", "..."),
|
42 |
+
(2, "π€", "If animals could talk, which species do you think would be the most annoying?", "..."),
|
43 |
+
# ... (remaining questions) ...
|
44 |
+
]
|
45 |
+
|
46 |
+
st.table(pd.DataFrame(data, columns=['Question', 'Emoji', 'Title', 'Description']))
|
47 |
+
|
48 |
+
def main():
|
49 |
+
display_graph()
|
50 |
+
display_table()
|
51 |
+
|
52 |
terms = [
|
53 |
'π Sensory Input',
|
54 |
'π‘ Thalamus',
|
|
|
63 |
upvote_button = st.button(f"π Upvote {term}")
|
64 |
downvote_button = st.button(f"π Downvote {term}")
|
65 |
|
66 |
+
# ... (upvote and downvote handling) ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
if __name__ == "__main__":
|
69 |
main()
|
|
|
|
|
|
|
|
|
|