Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
import json
|
4 |
-
from PIL import Image
|
5 |
|
6 |
-
# Set page configuration
|
7 |
-
st.set_page_config(page_title="๐๐
|
8 |
|
9 |
-
#
|
10 |
score_dir = "scores"
|
11 |
os.makedirs(score_dir, exist_ok=True)
|
12 |
|
13 |
-
# Function to generate a unique key for each button
|
14 |
def generate_key(label, header, idx):
|
15 |
-
|
16 |
-
return f"{header}_{label}_{idx}"
|
17 |
|
18 |
-
# Function to increment
|
19 |
def update_score(key, increment=1):
|
20 |
score_file = os.path.join(score_dir, f"{key}.json")
|
21 |
if os.path.exists(score_file):
|
@@ -41,50 +39,38 @@ def load_score(key):
|
|
41 |
return score_data["score"]
|
42 |
return 0
|
43 |
|
44 |
-
# Transhuman Space glossary
|
45 |
transhuman_glossary = {
|
46 |
-
"๐ Core Technologies": ["Nanotechnology", "Artificial Intelligence", "Quantum Computing", "Spacecraft Engineering", "Biotechnology", "Cybernetics", "Virtual Reality", "Energy Systems", "Material Science", "Communication Technologies"],
|
47 |
-
"๐ Nations": ["Terran Federation", "Martian Syndicate", "Jovian Republics", "Asteroid Belt Communities", "Venusian Colonies", "Lunar States", "Outer System Alliances", "Digital Consciousness Collectives", "Transhumanist Enclaves", "Non-Human Intelligence Tribes"],
|
48 |
-
"๐ก Memes": ["Post-Humanism", "Neo-Evolutionism", "Digital Ascendancy", "Solar System Nationalism", "Space Explorationism", "Cyber Democracy", "Interstellar Environmentalism", "Quantum Mysticism", "Techno-Anarchism", "Cosmic Preservationism"],
|
49 |
-
"๐ Institutions": ["Interstellar Council", "Transhuman Ethical Standards Organization", "Galactic Trade Union", "Space Habitat Authority", "Artificial Intelligence Safety Commission", "Extraterrestrial Relations Board", "Quantum Research Institute", "Biogenetics Oversight Committee", "Cyberspace Regulatory Agency", "Planetary Defense Coalition"],
|
50 |
-
"๐ Organizations": ["Neural Network Pioneers", "Spacecraft Innovators Guild", "Quantum Computing Consortium", "Interplanetary Miners Union", "Cybernetic Augmentation Advocates", "Biotechnological Harmony Group", "Stellar Navigation Circle", "Virtual Reality Creators Syndicate", "Renewable Energy Pioneers", "Transhuman Rights Activists"],
|
51 |
-
"โ๏ธ War": ["Space Warfare Tactics", "Cyber Warfare", "Biological Warfare", "Nanotech Warfare", "Psychological Operations", "Quantum Encryption & Decryption", "Kinetic Bombardment", "Energy Shield Defense", "Stealth Spacecraft", "Artificial Intelligence Combat"],
|
52 |
-
"๐ Military": ["Interstellar Navy", "Planetary Guard", "Cybernetic Marines", "Nanotech Soldiers", "Space Drone Fleet", "Quantum Signal Corps", "Special Operations Forces", "Artificial Intelligence Strategists", "Orbital Defense Systems", "Exoskeleton Brigades"],
|
53 |
-
"๐ฆน Outlaws": ["Pirate Fleets", "Hacktivist Collectives", "Smuggler Caravans", "Rebel AI Entities", "Black Market Biotech Dealers", "Quantum Thieves", "Space Nomad Raiders", "Cyberspace Intruders", "Anti-Transhumanist Factions", "Rogue Nanotech Swarms"],
|
54 |
-
"๐ฝ Terrorists": ["Bioengineered Virus Spreaders", "Nanotechnology Saboteurs", "Cyber Terrorist Networks", "Rogue AI Sects", "Space Anarchist Cells", "Quantum Data Hijackers", "Environmental Extremists", "Technological Singularity Cults", "Interspecies Supremacists", "Orbital Bombardment Threats"],
|
55 |
}
|
56 |
|
57 |
-
#
|
58 |
def display_glossary(area):
|
59 |
st.subheader(f"๐ Glossary for {area}")
|
60 |
terms = transhuman_glossary[area]
|
61 |
for idx, term in enumerate(terms, start=1):
|
62 |
st.write(f"{idx}. {term}")
|
63 |
|
64 |
-
#
|
65 |
def display_buttons_with_scores():
|
66 |
-
|
67 |
-
|
68 |
-
st.markdown(f"### {header}")
|
69 |
-
terms = transhuman_glossary[header]
|
70 |
for term in terms:
|
71 |
key = generate_key(term, header, terms.index(term))
|
72 |
score = load_score(key)
|
73 |
-
if st.button(f"{term} {score}", key=key):
|
74 |
-
|
75 |
st.experimental_rerun()
|
76 |
|
77 |
-
# Adapt existing functions for Transhuman Space storytelling
|
78 |
-
# Additional functions like `fetch_wikipedia_summary` can be adapted for fetching information
|
79 |
-
# from a science fiction database or API if available.
|
80 |
-
|
81 |
-
# Main application logic
|
82 |
if __name__ == "__main__":
|
83 |
-
st.title("
|
84 |
-
st.markdown("## Explore the
|
85 |
display_buttons_with_scores()
|
86 |
-
|
87 |
-
# Example extensions:
|
88 |
-
# - Implementing image galleries for spacecraft designs and characters.
|
89 |
-
# - Adding interactive maps of the solar system highlighting key locations in Transhuman Space.
|
90 |
-
# - Creating dynamic character and technology profiles that users can explore and modify.
|
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
import json
|
|
|
4 |
|
5 |
+
# Set page configuration with a title and favicon
|
6 |
+
st.set_page_config(page_title="๐๐ Transhuman Space Encyclopedia", page_icon="๐ ", layout="wide")
|
7 |
|
8 |
+
# Ensure the directory for storing scores exists
|
9 |
score_dir = "scores"
|
10 |
os.makedirs(score_dir, exist_ok=True)
|
11 |
|
12 |
+
# Function to generate a unique key for each button, including an emoji
|
13 |
def generate_key(label, header, idx):
|
14 |
+
return f"{header}_{label}_{idx}_key"
|
|
|
15 |
|
16 |
+
# Function to increment and save score
|
17 |
def update_score(key, increment=1):
|
18 |
score_file = os.path.join(score_dir, f"{key}.json")
|
19 |
if os.path.exists(score_file):
|
|
|
39 |
return score_data["score"]
|
40 |
return 0
|
41 |
|
42 |
+
# Transhuman Space glossary with full content
|
43 |
transhuman_glossary = {
|
44 |
+
"๐ Core Technologies": ["Nanotechnology๐ฌ", "Artificial Intelligence๐ค", "Quantum Computing๐ป", "Spacecraft Engineering๐ธ", "Biotechnology๐งฌ", "Cybernetics๐ฆพ", "Virtual Reality๐ถ๏ธ", "Energy Systemsโก", "Material Science๐งช", "Communication Technologies๐ก"],
|
45 |
+
"๐ Nations": ["Terran Federation๐", "Martian Syndicate๐ด", "Jovian Republics๐ช", "Asteroid Belt Communities๐", "Venusian Colonies๐", "Lunar States๐", "Outer System Alliancesโจ", "Digital Consciousness Collectives๐ง ", "Transhumanist Enclaves๐ฆฟ", "Non-Human Intelligence Tribes๐ฝ"],
|
46 |
+
"๐ก Memes": ["Post-Humanism๐ถโโ๏ธโก๏ธ๐", "Neo-Evolutionism๐งฌ๐", "Digital Ascendancy๐พ๐", "Solar System Nationalism๐๐", "Space Explorationism๐๐ฐ", "Cyber Democracy๐ฅ๏ธ๐ณ๏ธ", "Interstellar Environmentalism๐๐", "Quantum Mysticism๐ฎ๐ซ", "Techno-Anarchism๐๐ด", "Cosmic Preservationism๐๐ก๏ธ"],
|
47 |
+
"๐ Institutions": ["Interstellar Council๐ช", "Transhuman Ethical Standards Organization๐", "Galactic Trade Union๐ค", "Space Habitat Authority๐ ", "Artificial Intelligence Safety Commission๐ค๐", "Extraterrestrial Relations Board๐ฝ๐ค", "Quantum Research Institute๐ฌ", "Biogenetics Oversight Committee๐งซ", "Cyberspace Regulatory Agency๐ป", "Planetary Defense Coalition๐๐ก"],
|
48 |
+
"๐ Organizations": ["Neural Network Pioneers๐ง ๐", "Spacecraft Innovators Guild๐๐ ", "Quantum Computing Consortium๐ป๐", "Interplanetary Miners Unionโ๏ธ๐ช", "Cybernetic Augmentation Advocates๐ฆพโค๏ธ", "Biotechnological Harmony Group๐งฌ๐", "Stellar Navigation Circle๐งญโจ", "Virtual Reality Creators Syndicate๐ถ๏ธ๐จ", "Renewable Energy Pioneersโก๐ฑ", "Transhuman Rights Activists๐ฆฟ๐ข"],
|
49 |
+
"โ๏ธ War": ["Space Warfare Tactics๐โ๏ธ", "Cyber Warfare๐ฅ๏ธ๐", "Biological Warfare๐งฌ๐ฃ", "Nanotech Warfare๐ฌโ๏ธ", "Psychological Operations๐ง ๐ฃ๏ธ", "Quantum Encryption & Decryption๐๐ป", "Kinetic Bombardment๐๐ฅ", "Energy Shield Defense๐ก๏ธโก", "Stealth Spacecraft๐๐", "Artificial Intelligence Combat๐คโ๏ธ"],
|
50 |
+
"๐ Military": ["Interstellar Navy๐๐", "Planetary Guard๐๐ก", "Cybernetic Marines๐ฆพ๐ซ", "Nanotech Soldiers๐ฌ๐", "Space Drone Fleet๐ธ๐ค", "Quantum Signal Corps๐ป๐ก", "Special Operations Forces๐ฅโ๏ธ", "Artificial Intelligence Strategists๐ค๐บ๏ธ", "Orbital Defense Systems๐๐ก๏ธ", "Exoskeleton Brigades๐ฆพ๐ถโโ๏ธ"],
|
51 |
+
"๐ฆน Outlaws": ["Pirate Fleets๐ดโโ ๏ธ๐", "Hacktivist Collectives๐ป๐ซ", "Smuggler Caravans๐ธ๐ผ", "Rebel AI Entities๐ค๐ฉ", "Black Market Biotech Dealers๐งฌ๐ฐ", "Quantum Thieves๐ป๐ต๏ธโโ๏ธ", "Space Nomad Raiders๐๐ดโโ ๏ธ", "Cyberspace Intruders๐ป๐พ", "Anti-Transhumanist Factions๐ซ๐ฆพ", "Rogue Nanotech Swarms๐ฌ๐ฆ "],
|
52 |
+
"๐ฝ Terrorists": ["Bioengineered Virus Spreaders๐งฌ๐", "Nanotechnology Saboteurs๐ฌ๐งจ", "Cyber Terrorist Networks๐ป๐ฅ", "Rogue AI Sects๐ค๐", "Space Anarchist Cells๐โถ", "Quantum Data Hijackers๐ป๐", "Environmental Extremists๐๐ฃ", "Technological Singularity Cults๐ค๐", "Interspecies Supremacists๐ฝ๐", "Orbital Bombardment Threats๐ฐ๏ธ๐ฅ"],
|
53 |
}
|
54 |
|
55 |
+
# Display the glossary with Streamlit components, ensuring emojis are used
|
56 |
def display_glossary(area):
|
57 |
st.subheader(f"๐ Glossary for {area}")
|
58 |
terms = transhuman_glossary[area]
|
59 |
for idx, term in enumerate(terms, start=1):
|
60 |
st.write(f"{idx}. {term}")
|
61 |
|
62 |
+
# Streamlined UI for displaying buttons with scores, integrating emojis
|
63 |
def display_buttons_with_scores():
|
64 |
+
for header, terms in transhuman_glossary.items():
|
65 |
+
st.markdown(f"## {header}")
|
|
|
|
|
66 |
for term in terms:
|
67 |
key = generate_key(term, header, terms.index(term))
|
68 |
score = load_score(key)
|
69 |
+
if st.button(f"{term} {score}๐", key=key):
|
70 |
+
update_score(key)
|
71 |
st.experimental_rerun()
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
if __name__ == "__main__":
|
74 |
+
st.title("๐๐ Transhuman Space Encyclopedia")
|
75 |
+
st.markdown("## Explore the universe of Transhuman Space through interactive storytelling and encyclopedic knowledge.๐ ")
|
76 |
display_buttons_with_scores()
|
|
|
|
|
|
|
|
|
|