Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -51,51 +51,94 @@ def load_score(key):
|
|
51 |
return score_data["score"]
|
52 |
return 0
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
"
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
|
68 |
-
#
|
69 |
-
def search_glossary(query):
|
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 |
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 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
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.
|
117 |
-
|
118 |
-
|
119 |
-
|
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
|
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("
|
1166 |
-
display_glossary_grid(
|
1167 |
-
|
1168 |
-
st.
|
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 |
|