Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -159,25 +159,6 @@ def get_all_query_params(key):
|
|
| 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 |
|
| 182 |
# Function to display content or image based on a query
|
| 183 |
def display_content_or_image(query):
|
|
@@ -199,37 +180,7 @@ 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 |
-
st.write("Current Query Parameters:", st.query_params)
|
| 204 |
-
st.markdown("### Query Parameters - These Deep Link Map to Remixable Methods, Navigate or Trigger Functionalities")
|
| 205 |
-
|
| 206 |
-
# Example: Using query parameters to navigate or trigger functionalities
|
| 207 |
-
if 'action' in st.query_params:
|
| 208 |
-
action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
|
| 209 |
-
if action == 'show_message':
|
| 210 |
-
st.success("Showing a message because 'action=show_message' was found in the URL.")
|
| 211 |
-
elif action == 'clear':
|
| 212 |
-
clear_query_params()
|
| 213 |
-
st.experimental_rerun()
|
| 214 |
-
|
| 215 |
-
# Handling repeated keys
|
| 216 |
-
if 'multi' in st.query_params:
|
| 217 |
-
multi_values = get_all_query_params('multi')
|
| 218 |
-
st.write("Values for 'multi':", multi_values)
|
| 219 |
-
|
| 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
|
| 226 |
-
display_content_or_image(query)
|
| 227 |
-
|
| 228 |
-
# Add a clear query parameters button for convenience
|
| 229 |
-
if st.button("Clear Query Parameters", key='ClearQueryParams'):
|
| 230 |
-
# This will clear the browser URL's query parameters
|
| 231 |
-
st.experimental_set_query_params
|
| 232 |
-
st.experimental_rerun()
|
| 233 |
|
| 234 |
|
| 235 |
|
|
@@ -1149,6 +1100,59 @@ def main():
|
|
| 1149 |
filename = generate_filename(raw, 'txt')
|
| 1150 |
create_file(filename, raw, '', should_save)
|
| 1151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1152 |
# 18. Run AI Pipeline
|
| 1153 |
if __name__ == "__main__":
|
| 1154 |
whisper_main()
|
|
|
|
| 159 |
def clear_query_params():
|
| 160 |
st.query_params()
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
# Function to display content or image based on a query
|
| 164 |
def display_content_or_image(query):
|
|
|
|
| 180 |
# If no content or image is found
|
| 181 |
st.warning("No matching content or image found.")
|
| 182 |
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
|
| 186 |
|
|
|
|
| 1100 |
filename = generate_filename(raw, 'txt')
|
| 1101 |
create_file(filename, raw, '', should_save)
|
| 1102 |
|
| 1103 |
+
|
| 1104 |
+
|
| 1105 |
+
|
| 1106 |
+
# Relocated! Hope you like your new space - enjoy!
|
| 1107 |
+
# Display instructions and handle query parameters
|
| 1108 |
+
st.markdown("## Glossary Lookup\nEnter a term in the URL query, like `?q=Nanotechnology` or `?query=Martian Syndicate`.")
|
| 1109 |
+
query_params = st.query_params
|
| 1110 |
+
query = (query_params.get('q') or query_params.get('query') or [''])[0]
|
| 1111 |
+
if query: search_glossary(query)
|
| 1112 |
+
|
| 1113 |
+
# Display the glossary grid
|
| 1114 |
+
st.title("Transhuman Space Glossary ๐")
|
| 1115 |
+
display_glossary_grid(transhuman_glossary)
|
| 1116 |
+
|
| 1117 |
+
st.title("๐๐ Transhuman Space Encyclopedia")
|
| 1118 |
+
st.markdown("## Explore the universe of Transhuman Space through interactive storytelling and encyclopedic knowledge.๐ ")
|
| 1119 |
+
|
| 1120 |
+
display_buttons_with_scores()
|
| 1121 |
+
|
| 1122 |
+
display_images_and_wikipedia_summaries()
|
| 1123 |
+
|
| 1124 |
+
# Assuming the transhuman_glossary and other setup code remains the same
|
| 1125 |
+
st.write("Current Query Parameters:", st.query_params)
|
| 1126 |
+
st.markdown("### Query Parameters - These Deep Link Map to Remixable Methods, Navigate or Trigger Functionalities")
|
| 1127 |
+
|
| 1128 |
+
# Example: Using query parameters to navigate or trigger functionalities
|
| 1129 |
+
if 'action' in st.query_params:
|
| 1130 |
+
action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
|
| 1131 |
+
if action == 'show_message':
|
| 1132 |
+
st.success("Showing a message because 'action=show_message' was found in the URL.")
|
| 1133 |
+
elif action == 'clear':
|
| 1134 |
+
clear_query_params()
|
| 1135 |
+
st.experimental_rerun()
|
| 1136 |
+
|
| 1137 |
+
# Handling repeated keys
|
| 1138 |
+
if 'multi' in st.query_params:
|
| 1139 |
+
multi_values = get_all_query_params('multi')
|
| 1140 |
+
st.write("Values for 'multi':", multi_values)
|
| 1141 |
+
|
| 1142 |
+
# Manual entry for demonstration
|
| 1143 |
+
st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
| 1144 |
+
|
| 1145 |
+
if 'query' in st.query_params:
|
| 1146 |
+
query = st.query_params['query'][0] # Get the query parameter
|
| 1147 |
+
# Display content or image based on the query
|
| 1148 |
+
display_content_or_image(query)
|
| 1149 |
+
|
| 1150 |
+
# Add a clear query parameters button for convenience
|
| 1151 |
+
if st.button("Clear Query Parameters", key='ClearQueryParams'):
|
| 1152 |
+
# This will clear the browser URL's query parameters
|
| 1153 |
+
st.experimental_set_query_params
|
| 1154 |
+
st.experimental_rerun()
|
| 1155 |
+
|
| 1156 |
# 18. Run AI Pipeline
|
| 1157 |
if __name__ == "__main__":
|
| 1158 |
whisper_main()
|