import streamlit as st from graphviz import Digraph import json import os import pandas as pd def create_amygdala_hijacking_graph(): g = Digraph('Amygdala_Hijacking', format='png') g.attr(fontname="Helvetica,Arial,sans-serif") g.attr('node', fontname="Helvetica,Arial,sans-serif") g.attr('edge', fontname="Helvetica,Arial,sans-serif") g.attr('graph', newrank='true', nodesep='0.3', ranksep='0.2', overlap='true', splines='false') g.attr('node', fixedsize='false', fontsize='24', height='1', shape='box', style='filled,setlinewidth(5)', width='2.2', penwidth='3') g.attr('edge', arrowhead='none', arrowsize='0.5', labelfontname="Ubuntu", weight='10', style='filled,setlinewidth(5)') g.node('1', '👂 Sensory Input', fillcolor='lightblue') g.node('2', 'ðŸ“Ą Thalamus', fillcolor='palegreen') g.node('3', 'ðŸ”ī Amygdala', color='red', fillcolor='red', fontcolor='white') g.node('4', '📚 Hippocampus', fillcolor='lightyellow') g.node('5', 'ðŸ’Ą Prefrontal Cortex', fillcolor='lightpink') g.node('6', '🎎 Response', fillcolor='lightgray') g.edge('1', '2', label='🌐 Receives Signals') g.edge('2', '3', label='⚡ Quick, Emotional Response') g.edge('2', '4', label='🔀 Sends Signals To') g.edge('4', '5', label='🔄 Relays Information') g.edge('5', '3', label='🧠 Rational Control (If Not Hijacked)') g.edge('3', '6', label='🏃 Generates Response') return g def display_graph(): st.title("Amygdala Hijacking Visualization") amygdala_hijacking_graph = create_amygdala_hijacking_graph() st.graphviz_chart(amygdala_hijacking_graph) def display_table(): st.title("Fun Questions Table") data = [ (1, "😂", "How many cups of coffee do you need to function like a normal human being?", "[Wikipedia](https://en.wikipedia.org/wiki/Coffee)"), (2, "ðŸĪ”", "If animals could talk, which species do you think would be the most annoying?", "[Wikipedia](https://en.wikipedia.org/wiki/Animal_communication)"), (3, "ðŸĪŦ", "What's the craziest conspiracy theory you've ever heard?", "[Wikipedia](https://en.wikipedia.org/wiki/Conspiracy_theory)"), (4, "ðŸĪĢ", "What's the worst pickup line you've ever heard or used?", "[Wikipedia](https://en.wikipedia.org/wiki/Pick-up_line)"), (5, "😜", "If you were a superhero, what would your superpower be?", "[Wikipedia](https://en.wikipedia.org/wiki/Superpower_(ability))"), (6, "ðŸĪŊ", "If you could time travel, what period in history would you go to and why?", "[Wikipedia](https://en.wikipedia.org/wiki/Time_travel)"), (7, "😝", "What's the weirdest thing you've ever eaten?", "[Wikipedia](https://en.wikipedia.org/wiki/List_of_delicacies)"), (8, "ðŸĪŠ", "What's the most embarrassing thing that's ever happened to you in public?", "[Wikipedia](https://en.wikipedia.org/wiki/Embarrassment)"), (9, "😈", "If you could be any movie villain, who would you choose and why?", "[Wikipedia](https://en.wikipedia.org/wiki/Villain)"), (10, "🙃", "What's the most useless talent you have?", "[Wikipedia](https://en.wikipedia.org/wiki/Talent_(human))"), ] df=pd.DataFrame(data, columns=['Question', 'Emoji', 'Title', 'Description']) st.table(df) # simplest dataframe view #edited_df = st.data_editor(df) # robust df editor #favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"] #st.markdown(f"Your favorite command is **{favorite_command}** 🎈") def update_vote_log(term, vote_type): with open('vote.log.txt', 'a') as f: f.write(json.dumps({'term': term, 'vote': vote_type}) + '\n') def load_vote_log(): vote_data = [] if os.path.exists('vote.log.txt'): with open('vote.log.txt', 'r') as f: for line in f.readlines(): vote_data.append(json.loads(line.strip())) return vote_data def count_votes(vote_data, term): upvotes = sum(1 for vote in vote_data if vote['term'] == term and vote['vote'] == 'upvote') downvotes = sum(1 for vote in vote_data if vote['term'] == term and vote['vote'] == 'downvote') return upvotes, downvotes def main(): display_graph() display_table() terms = [ '👂 Sensory Input', 'ðŸ“Ą Thalamus', 'ðŸ”ī Amygdala', '📚 Hippocampus', 'ðŸ’Ą Prefrontal Cortex', '🎎 Response' ] vote_data = load_vote_log() for term in terms: st.write(term) upvotes, downvotes = count_votes(vote_data, term) st.write(f"Total upvotes: {upvotes}") st.write(f"Total downvotes: {downvotes}") upvote_button = st.button(f"👍 Upvote {term}") downvote_button = st.button(f"👎 Downvote {term}") if upvote_button: update_vote_log(term, 'upvote') st.experimental_rerun() if downvote_button: update_vote_log(term, 'downvote') st.experimental_rerun() if __name__ == "__main__": main()