Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,12 +61,6 @@ def search_glossary(query):
|
|
| 61 |
st.markdown(f"### {category}")
|
| 62 |
st.write(f"- {query}")
|
| 63 |
|
| 64 |
-
# Display instructions and handle query parameters
|
| 65 |
-
st.markdown("## Glossary Lookup\nEnter a term in the URL query, like `?q=Nanotechnology` or `?query=Martian Syndicate`.")
|
| 66 |
-
query_params = st.query_params
|
| 67 |
-
query = (query_params.get('q') or query_params.get('query') or [''])[0]
|
| 68 |
-
if query: search_glossary(query)
|
| 69 |
-
|
| 70 |
|
| 71 |
|
| 72 |
# Display the glossary with Streamlit components, ensuring emojis are used
|
|
@@ -95,10 +89,6 @@ def display_glossary_grid(glossary):
|
|
| 95 |
for term in terms:
|
| 96 |
st.write(f"- {term}")
|
| 97 |
|
| 98 |
-
# Display the glossary grid
|
| 99 |
-
st.title("Transhuman Space Glossary ๐")
|
| 100 |
-
display_glossary_grid(transhuman_glossary)
|
| 101 |
-
|
| 102 |
# Streamlined UI for displaying buttons with scores, integrating emojis
|
| 103 |
def display_buttons_with_scores():
|
| 104 |
for header, terms in transhuman_glossary.items():
|
|
@@ -110,13 +100,6 @@ def display_buttons_with_scores():
|
|
| 110 |
update_score(key)
|
| 111 |
st.experimental_rerun()
|
| 112 |
|
| 113 |
-
if __name__ == "__main__":
|
| 114 |
-
st.title("๐๐ Transhuman Space Encyclopedia")
|
| 115 |
-
st.markdown("## Explore the universe of Transhuman Space through interactive storytelling and encyclopedic knowledge.๐ ")
|
| 116 |
-
display_buttons_with_scores()
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
|
| 121 |
|
| 122 |
|
|
@@ -169,13 +152,30 @@ def display_images_and_wikipedia_summaries():
|
|
| 169 |
"""
|
| 170 |
st.markdown(links_md)
|
| 171 |
|
| 172 |
-
display_images_and_wikipedia_summaries()
|
| 173 |
|
| 174 |
def get_all_query_params(key):
|
| 175 |
return st.query_params().get(key, [])
|
| 176 |
|
| 177 |
def clear_query_params():
|
| 178 |
st.query_params()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
# Assuming the transhuman_glossary and other setup code remains the same
|
| 181 |
|
|
@@ -199,9 +199,6 @@ def display_content_or_image(query):
|
|
| 199 |
# If no content or image is found
|
| 200 |
st.warning("No matching content or image found.")
|
| 201 |
return False
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
|
| 206 |
st.write("Current Query Parameters:", st.query_params)
|
| 207 |
st.markdown("### Query Parameters - These Deep Link Map to Remixable Methods, Navigate or Trigger Functionalities")
|
|
@@ -223,9 +220,6 @@ if 'multi' in st.query_params:
|
|
| 223 |
# Manual entry for demonstration
|
| 224 |
st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
| 225 |
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
if 'query' in st.query_params:
|
| 230 |
query = st.query_params['query'][0] # Get the query parameter
|
| 231 |
# Display content or image based on the query
|
|
|
|
| 61 |
st.markdown(f"### {category}")
|
| 62 |
st.write(f"- {query}")
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
# Display the glossary with Streamlit components, ensuring emojis are used
|
|
|
|
| 89 |
for term in terms:
|
| 90 |
st.write(f"- {term}")
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
# Streamlined UI for displaying buttons with scores, integrating emojis
|
| 93 |
def display_buttons_with_scores():
|
| 94 |
for header, terms in transhuman_glossary.items():
|
|
|
|
| 100 |
update_score(key)
|
| 101 |
st.experimental_rerun()
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
|
|
|
|
| 152 |
"""
|
| 153 |
st.markdown(links_md)
|
| 154 |
|
|
|
|
| 155 |
|
| 156 |
def get_all_query_params(key):
|
| 157 |
return st.query_params().get(key, [])
|
| 158 |
|
| 159 |
def clear_query_params():
|
| 160 |
st.query_params()
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
# Display instructions and handle query parameters
|
| 164 |
+
st.markdown("## Glossary Lookup\nEnter a term in the URL query, like `?q=Nanotechnology` or `?query=Martian Syndicate`.")
|
| 165 |
+
query_params = st.query_params
|
| 166 |
+
query = (query_params.get('q') or query_params.get('query') or [''])[0]
|
| 167 |
+
if query: search_glossary(query)
|
| 168 |
+
|
| 169 |
+
# Display the glossary grid
|
| 170 |
+
st.title("Transhuman Space Glossary ๐")
|
| 171 |
+
display_glossary_grid(transhuman_glossary)
|
| 172 |
+
|
| 173 |
+
st.title("๐๐ Transhuman Space Encyclopedia")
|
| 174 |
+
st.markdown("## Explore the universe of Transhuman Space through interactive storytelling and encyclopedic knowledge.๐ ")
|
| 175 |
+
|
| 176 |
+
display_buttons_with_scores()
|
| 177 |
+
|
| 178 |
+
display_images_and_wikipedia_summaries()
|
| 179 |
|
| 180 |
# Assuming the transhuman_glossary and other setup code remains the same
|
| 181 |
|
|
|
|
| 199 |
# If no content or image is found
|
| 200 |
st.warning("No matching content or image found.")
|
| 201 |
return False
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
st.write("Current Query Parameters:", st.query_params)
|
| 204 |
st.markdown("### Query Parameters - These Deep Link Map to Remixable Methods, Navigate or Trigger Functionalities")
|
|
|
|
| 220 |
# Manual entry for demonstration
|
| 221 |
st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
| 222 |
|
|
|
|
|
|
|
|
|
|
| 223 |
if 'query' in st.query_params:
|
| 224 |
query = st.query_params['query'][0] # Get the query parameter
|
| 225 |
# Display content or image based on the query
|