awacke1 commited on
Commit
693209f
1 Parent(s): 3bd455c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +99 -66
app.py CHANGED
@@ -51,51 +51,94 @@ def load_score(key):
51
  return score_data["score"]
52
  return 0
53
 
54
-
55
- # Enhanced Transhuman Space glossary with futuristic content
56
- transhuman_glossary = {
57
- "🚀 Core Technologies": ["Gene Editing🧬 (CRISPR)", "Neural Interface Technology🧠⚡", "Advanced Robotics🤖🛠", "Sustainable Energy Systems🌱⚡", "Augmented Reality (AR)🕶️", "3D Bioprinting🖨️🧬", "Nano Medicine🔬💊", "Blockchain for Security🔗🔒", "Synthetic Biology🧪🌿", "Autonomous Vehicles🚗💨"],
58
- "🌐 Nations": ["United Earth Government🌍", "Off-Earth Mining Corporations🌌⛏️", "Underwater Habitat States🌊🏠", "Orbital Colony Federations🛰️🤝", "High-altitude Aerostat Communities☁️🏠", "Virtual Nations🌐👾", "AI Sovereignties🤖👑", "Genetically Modified Enclaves🧬🏞️", "Space Elevator Consortiums🚀⚙️", "Quantum Computing Havens💻🔐"],
59
- "💡 Memes": ["Trans-speciesism🧬🐅➡️🚀", "Eco-technologism🌍🔧", "Mind Uploading💾🧠", "Multi-planetary Living🪐🏠", "Robot Rights Activism🤖❤️", "Virtual Reality Societies🕶️🌐", "Quantum Consciousness🔮🧠", "Solar System Restorationism🌞🌱", "Post-Scarcity Economics💰➡️🔄", "Cyber-physical Integration🖥️🦾"],
60
- "🏛 Institutions": ["Global AI Ethics Board🤖📜", "Interplanetary Health Organization🪐💉", "Deep Space Exploration Agency🌌🚀", "Human Augmentation Regulatory Commission🦾📏", "Environmental Reclamation Bureau🌍💚", "Quantum Computing Oversight🔬💻", "Synthetic Ecosystems Management🌿🧬", "Universal Basic Income Council💰🌍", "Cybersecurity Task Force🔒🌐", "Exobiology Research Institute👽🔬"],
61
- "🔗 Organizations": ["Quantum Encryption Innovators💻🔒", "Space Habitat Architects🛰️🏗️", "Neurotechnology Pioneers🧠🔌", "Renewable Energy Coalitions⚡🌞", "Augmented Reality Developers🕶️💡", "Personalized Medicine Labs🧬💊", "AI for Good Collectives🤖❤️", "Nanotech Environmentalists🔬🌱", "Human Enhancement Advocates🦾🌟", "Interstellar Communication Networkers📡✨"],
62
- "⚔️ War": ["Anti-Drone Warfare Systems🚁⚔️", "Electromagnetic Pulse (EMP) Defense🌩️🔒", "Genetic Warfare Defense🧬🛡️", "Quantum Hacking Countermeasures💻🛡️", "Space Debris Clearing Operations🚀🧹", "Cybernetic Combat Units🦾⚔️", "Orbital Weapon Platforms🛰️💥", "Artificially Intelligent Strategy Engines🤖🗺️", "Stealth Nanobots🔬🔇", "Climate Control Warfare🌍🌪️"],
63
- "🎖 Military": ["Space Marine Corps🚀🎖️", "Planetary Defense Networks🌍🔗", "Quantum Communication Squads💻📡", "High-altitude UAV Fleets☁️🚁", "Exosuit Assault Teams🦾🚶‍♂️", "Autonomous Combat Drones🤖🛸", "Deep Space Reconnaissance Units🌌🔭", "Cyber Warfare Divisions💻🔒", "Genetic Modification Troops🧬👥", "Orbital Drop Shock Troopers🛰️🪂"],
64
- "🦹 Outlaws": ["Quantum Hackers💻🎭", "Gene Piracy Rings🧬💰", "AI Syndicates🤖🚫", "Space Smugglers🚀💼", "Underground Augmentation Labs🔬🦾", "Virtual Heist Crews🕶️💾", "Nanotech Smugglers🔬🚚", "Anti-AI Militias🤖❌", "Orbital Hijackers🛰️🔫", "Climate Hackers🌍💻"],
65
- "👽 Terrorists": ["Synthetic Virus Creators🧬🦠", "EMP Terrorists🌩️💣", "Dark Web Cults💻🕯️", "Nanotech Extremists🔬🧨", "Anti-Humanity Sects🚫🚶‍♂️", "Quantum Data Destroyers💻🧨", "Terraforming Saboteurs🌍🔧", "Mind Control Radicals🧠📡", "Space Station Seizers🛰️🚨", "Transdimensional Threats🌀👽"],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
68
- # Updated function to search glossary and display results with enhanced content
69
- def search_glossary(query):
70
- for category, terms in transhuman_glossary.items():
71
- if query.lower() in (term.lower() for term in terms):
72
- st.markdown(f"#### {category}")
73
- st.write(f"- {query}")
74
-
75
- st.write('## Processing query against GPT and Llama:')
76
- # ------------------------------------------------------------------------------------------------
77
- st.write('Reasoning with your inputs using GPT...')
78
- response = chat_with_model(query)
79
- st.write('Response:')
80
- st.write(response)
81
- filename = generate_filename(response, "txt")
82
- create_file(filename, query, response, should_save)
83
-
84
- st.write('Reasoning with your inputs using Llama...')
85
- response = StreamLLMChatResponse(query)
86
- filename_txt = generate_filename(query, "md")
87
- create_file(filename_txt, query, response, should_save)
88
- # ------------------------------------------------------------------------------------------------
89
-
90
- # Display the glossary with Streamlit components, ensuring emojis are used
91
- def display_glossary(area):
92
- st.subheader(f"📘 Glossary for {area}")
93
- terms = transhuman_glossary[area]
94
- for idx, term in enumerate(terms, start=1):
95
- st.write(f"{idx}. {term}")
96
-
97
- def display_glossary_grid(glossary):
98
- # Search URL functions with emoji as keys, now using quote for URL safety
 
 
99
  search_urls = {
100
  "📖": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
101
  "🔍": lambda k: f"https://www.google.com/search?q={quote(k)}",
@@ -103,31 +146,22 @@ def display_glossary_grid(glossary):
103
  "🔎": lambda k: f"https://www.bing.com/search?q={quote(k)}"
104
  }
105
 
106
- groupings = [
107
- ["🚀 Core Technologies", "🌐 Nations", "💡 Memes"],
108
- ["🏛 Institutions", "🔗 Organizations", "⚔️ War"],
109
- ["🎖 Military", "🦹 Outlaws", "👽 Terrorists"],
110
- ]
111
-
112
- for group in groupings:
113
- cols = st.columns(3) # Create columns for a 3x3 grid
114
- for idx, category in enumerate(group):
115
  with cols[idx]:
116
- st.write(f"### {category}")
117
- if category in glossary:
118
- terms = glossary[category]
119
- for term in terms:
120
- # Generate and display links for each term, now safely encoding URLs
121
- links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
122
- st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
123
 
124
-
125
 
126
 
127
 
128
  # Streamlined UI for displaying buttons with scores, integrating emojis
129
  def display_buttons_with_scores():
130
- for header, terms in transhuman_glossary.items():
131
  st.markdown(f"## {header}")
132
  for term in terms:
133
  key = generate_key(term, header, terms.index(term))
@@ -1162,11 +1196,10 @@ def main():
1162
  st.markdown('No glossary lookup')
1163
 
1164
  # Display the glossary grid
1165
- st.title("Transhuman Space Glossary 🌌")
1166
- display_glossary_grid(transhuman_glossary)
1167
-
1168
- st.title("🌌🚀 Transhuman Space Encyclopedia")
1169
- st.markdown("## Explore the universe of Transhuman Space through interactive storytelling and encyclopedic knowledge.🌠")
1170
 
1171
  display_buttons_with_scores()
1172
 
 
51
  return score_data["score"]
52
  return 0
53
 
54
+ roleplaying_glossary = {
55
+ "🎲 Core Rulebooks": {
56
+ "Dungeons and Dragons": ["Player's Handbook", "Dungeon Master's Guide", "Monster Manual"],
57
+ "Call of Cthulhu": ["Keeper's Rulebook", "Investigator Handbook", "Monster Manual"],
58
+ "GURPS": ["Basic Set: Characters", "Basic Set: Campaigns", "GURPS Lite"],
59
+ "Pathfinder": ["Core Rulebook", "Bestiary", "GameMastery Guide"],
60
+ },
61
+ "🗺️ Maps & Settings": {
62
+ "Dungeons and Dragons": ["The Forgotten Realms", "Eberron", "Ravenloft"],
63
+ "Gamma World": ["Gamma Terra", "The Wastelands"],
64
+ "Car Wars": ["Autoduel America", "The Arenas"],
65
+ "Top Secret": ["World of Espionage", "Mission Modules"],
66
+ },
67
+ "🛠️ Game Mechanics & Tools": {
68
+ "GURPS": ["GURPS Character Sheet", "GURPS Calculator", "Modular System for Custom Campaigns"],
69
+ "Pathfinder": ["Pathfinder Character Sheet", "Pathfinder Spell Database", "Adventure Path Modules"],
70
+ "Call of Cthulhu": ["Sanity System", "Investigator's Companion", "Mythos Tomes"],
71
+ },
72
+ "🧟 Monsters & Adversaries": {
73
+ "Dungeons and Dragons": ["Beholder", "Dragon", "Lich"],
74
+ "Call of Cthulhu": ["Great Old Ones", "Deep Ones", "Shoggoth"],
75
+ "Pathfinder": ["Goblins", "Dragons", "Vampires"],
76
+ },
77
+ "📜 Campaigns & Adventures": {
78
+ "Dungeons and Dragons": ["Curse of Strahd", "Tomb of Annihilation", "Waterdeep: Dragon Heist"],
79
+ "Gamma World": ["Legion of Gold", "Famine in Far-Go"],
80
+ "Call of Cthulhu": ["The Masks of Nyarlathotep", "The Haunting"],
81
+ "GURPS": ["Banestorm", "Infinite Worlds"],
82
+ },
83
+ "🎨 Creatives & Assets": {
84
+ "General RPG": ["Character Artwork", "Map Generators", "Token Creators"],
85
+ "Digital Tools": ["Roll20 Assets", "Fantasy Grounds Modules", "Tabletop Simulator Packs"],
86
+ },
87
+ "🔧 Game Master Resources": {
88
+ "General Tips": ["Campaign Planning", "NPC Creation", "World-Building"],
89
+ "Adventure Hooks": ["Mystery", "Exploration", "Conflict"],
90
+ "Puzzle & Trap Ideas": ["Logic Puzzles", "Physical Traps", "Social Encounters"],
91
+ },
92
+ "📚 Lore & Background": {
93
+ "Dungeons and Dragons": ["The Pantheon of Deities", "Historic Timelines", "Cultural Customs"],
94
+ "Pathfinder": ["Golarion", "Inner Sea Gods", "The Starstone"],
95
+ "Call of Cthulhu": ["The Cthulhu Mythos", "Historic Campaign Settings", "Cosmic Horrors"],
96
+ },
97
+ "🎖️ Character Development": {
98
+ "Skill Systems": ["Class-Based", "Skill-Based", "Level-Less Progression"],
99
+ "Alignment & Morality": ["Law vs. Chaos", "Good vs. Evil", "Neutrality"],
100
+ "Character Backstories": ["Origin Stories", "Character Flaws", "Personal Goals"],
101
+ },
102
+ "⚙️ Homebrew Content": {
103
+ "Rule Modifications": ["House Rules", "Alternate Magic Systems", "Custom Races & Classes"],
104
+ "Homebrew Campaigns": ["World Building Guides", "Custom Adventures", "NPC Galleries"],
105
+ "Creative Tools": ["Homebrewery", "D&D Beyond Homebrew", "GMBinder"],
106
+ },
107
  }
108
 
109
+ # Function to search within the roleplaying glossary and display results
110
+ def search_glossary(query, roleplaying_glossary):
111
+ found = False
112
+ for category, details in roleplaying_glossary.items():
113
+ for game, terms in details.items():
114
+ if query.lower() in ' '.join(terms).lower():
115
+ if not found:
116
+ st.markdown(f"#### Results for '{query}'")
117
+ found = True
118
+ st.markdown(f"**{category} -> {game}:**")
119
+ for term in terms:
120
+ if query.lower() in term.lower():
121
+ st.write(f"- {term}")
122
+
123
+ if not found:
124
+ st.write("No results found.")
125
+ # Example placeholder for processing query with models
126
+ st.write('## Processing query against AI models: Placeholder for integration')
127
+
128
+
129
+
130
+ # Function to display the glossary in a structured format
131
+ def display_glossary(glossary, area):
132
+ if area in glossary:
133
+ st.subheader(f"📘 Glossary for {area}")
134
+ for game, terms in glossary[area].items():
135
+ st.markdown(f"### {game}")
136
+ for idx, term in enumerate(terms, start=1):
137
+ st.write(f"{idx}. {term}")
138
+
139
+
140
+ # Function to display the entire glossary in a grid format with links
141
+ def display_glossary_grid(roleplaying_glossary):
142
  search_urls = {
143
  "📖": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
144
  "🔍": lambda k: f"https://www.google.com/search?q={quote(k)}",
 
146
  "🔎": lambda k: f"https://www.bing.com/search?q={quote(k)}"
147
  }
148
 
149
+ for category, details in roleplaying_glossary.items():
150
+ st.write(f"### {category}")
151
+ cols = st.columns(len(details)) # Create dynamic columns based on the number of games
152
+ for idx, (game, terms) in enumerate(details.items()):
 
 
 
 
 
153
  with cols[idx]:
154
+ st.markdown(f"#### {game}")
155
+ for term in terms:
156
+ links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
157
+ st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
 
 
 
158
 
 
159
 
160
 
161
 
162
  # Streamlined UI for displaying buttons with scores, integrating emojis
163
  def display_buttons_with_scores():
164
+ for header, terms in roleplaying_glossary.items():
165
  st.markdown(f"## {header}")
166
  for term in terms:
167
  key = generate_key(term, header, terms.index(term))
 
1196
  st.markdown('No glossary lookup')
1197
 
1198
  # Display the glossary grid
1199
+ st.title("Roleplaying Games Glossary 🎲")
1200
+ display_glossary_grid(roleplaying_glossary)
1201
+ st.title("🎲🗺️ Roleplaying Game Universe")
1202
+ st.markdown("## Explore the vast universes of Dungeons and Dragons, Call of Cthulhu, GURPS, and more through interactive storytelling and encyclopedic knowledge.🌠")
 
1203
 
1204
  display_buttons_with_scores()
1205