Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,6 @@ if 'view_mode' not in st.session_state:
|
|
14 |
st.session_state.view_mode = 'view'
|
15 |
if 'files' not in st.session_state:
|
16 |
st.session_state.files = []
|
17 |
-
if 'file_list_updated' not in st.session_state:
|
18 |
-
st.session_state.file_list_updated = False
|
19 |
|
20 |
# Define the markdown variables
|
21 |
Boxing_and_MMA_Commentary_and_Knowledge = """
|
@@ -34,16 +32,17 @@ Boxing_and_MMA_Commentary_and_Knowledge = """
|
|
34 |
- BJ Penn
|
35 |
- Anderson Silva
|
36 |
- Mighty Mouse MMA's heart at 125 pounds
|
37 |
-
-
|
38 |
-
- Fedor
|
39 |
- Alex Pereira
|
40 |
-
- James
|
41 |
- Randy Couture
|
42 |
3. You have to Judge them in their Championship Peak
|
43 |
4. Chris Weidman
|
44 |
-
5.
|
45 |
6. Leg Breaking - Shin calcification and breaking baseball bats
|
46 |
|
|
|
47 |
# References:
|
48 |
1. Joe Rogan - Interview #2219
|
49 |
2. Donald J Trump
|
@@ -52,33 +51,33 @@ Boxing_and_MMA_Commentary_and_Knowledge = """
|
|
52 |
Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds = """
|
53 |
# Multiplayer Simulated Worlds
|
54 |
|
55 |
-
1. 7 Days To Die PC
|
56 |
-
2. ARK: Survival Evolved PC
|
57 |
-
3. Arma 3 PC
|
58 |
-
4. Atlas PC
|
59 |
-
5. Conan Exiles PC
|
60 |
-
6. Craftopia PC
|
61 |
-
7. DayZ PC
|
62 |
-
8. Eco - Global Survival PC
|
63 |
-
9. Empyrion - Galactic Survival PC
|
64 |
-
10. Factorio PC
|
65 |
-
11. Farming Simulator 19 PC
|
66 |
12. Crossplay
|
67 |
-
13. Farming Simulator 22
|
68 |
-
14. Last Oasis PC
|
69 |
-
15. Last Oasis Classic PC
|
70 |
-
16. Minecraft (Vanilla) PC
|
71 |
17. Crossplay
|
72 |
18. Path of Titans
|
73 |
-
19. Rust PC
|
74 |
-
20. SCP: Secret Laboratory PC
|
75 |
21. SCUM PC
|
76 |
22. Satisfactory PC
|
77 |
-
23. Satisfactory (Experimental) PC
|
78 |
24. Crossplay
|
79 |
-
25. Space Engineers
|
80 |
-
26. Terraria (tShock & Vanilla) PC
|
81 |
-
27. The Forest PC
|
82 |
28. Crossplay
|
83 |
29. Valheim
|
84 |
"""
|
@@ -97,8 +96,10 @@ def extract_terms(markdown_text):
|
|
97 |
def display_terms_with_links(terms):
|
98 |
def generate_arxiv_link(term):
|
99 |
params = {'term': term}
|
100 |
-
|
101 |
-
|
|
|
|
|
102 |
|
103 |
search_urls = {
|
104 |
"🚀🌌ArXiv": lambda k: generate_arxiv_link(k),
|
@@ -179,9 +180,9 @@ def generate_filename(prefix, content, ai_output):
|
|
179 |
# Function to process query parameters and handle AI lookup
|
180 |
def process_query_parameters():
|
181 |
query_params = st.experimental_get_query_params()
|
182 |
-
|
183 |
-
if
|
184 |
-
term =
|
185 |
if len(term) > 1:
|
186 |
st.write(f"### Search term received: {term}")
|
187 |
# Perform AI lookup
|
@@ -200,8 +201,6 @@ def process_query_parameters():
|
|
200 |
# Update session state
|
201 |
st.session_state.selected_file = filename
|
202 |
st.session_state.view_mode = 'view'
|
203 |
-
# Mark that the file list needs to be updated
|
204 |
-
st.session_state.file_list_updated = True
|
205 |
|
206 |
# Sidebar for file management
|
207 |
def file_management_sidebar():
|
@@ -238,7 +237,6 @@ def file_management_sidebar():
|
|
238 |
st.sidebar.success(f"Created new file: {new_filename}")
|
239 |
st.session_state.selected_file = new_filename
|
240 |
st.session_state.view_mode = 'edit'
|
241 |
-
st.session_state.file_list_updated = True
|
242 |
else:
|
243 |
st.sidebar.write("No markdown files found.")
|
244 |
if st.sidebar.button("Create New Markdown File"):
|
@@ -250,7 +248,6 @@ def file_management_sidebar():
|
|
250 |
st.sidebar.success(f"Created new file: {new_filename}")
|
251 |
st.session_state.selected_file = new_filename
|
252 |
st.session_state.view_mode = 'edit'
|
253 |
-
st.session_state.file_list_updated = True
|
254 |
|
255 |
# Main application logic
|
256 |
def main():
|
@@ -293,11 +290,6 @@ def main():
|
|
293 |
# File management sidebar
|
294 |
file_management_sidebar()
|
295 |
|
296 |
-
# Update file list if needed
|
297 |
-
if st.session_state.get('file_list_updated', False):
|
298 |
-
st.session_state.files = [file for file in glob.glob("*.md") if os.path.basename(file).lower() != 'readme.md']
|
299 |
-
st.session_state.file_list_updated = False
|
300 |
-
|
301 |
# Display the selected file
|
302 |
selected_file = st.session_state.get('selected_file')
|
303 |
if selected_file:
|
|
|
14 |
st.session_state.view_mode = 'view'
|
15 |
if 'files' not in st.session_state:
|
16 |
st.session_state.files = []
|
|
|
|
|
17 |
|
18 |
# Define the markdown variables
|
19 |
Boxing_and_MMA_Commentary_and_Knowledge = """
|
|
|
32 |
- BJ Penn
|
33 |
- Anderson Silva
|
34 |
- Mighty Mouse MMA's heart at 125 pounds
|
35 |
+
- Kabib retired 29 and 0
|
36 |
+
- Fedor Milliano
|
37 |
- Alex Pereira
|
38 |
+
- James Tony
|
39 |
- Randy Couture
|
40 |
3. You have to Judge them in their Championship Peak
|
41 |
4. Chris Weidman
|
42 |
+
5. Connor McGregor
|
43 |
6. Leg Breaking - Shin calcification and breaking baseball bats
|
44 |
|
45 |
+
|
46 |
# References:
|
47 |
1. Joe Rogan - Interview #2219
|
48 |
2. Donald J Trump
|
|
|
51 |
Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds = """
|
52 |
# Multiplayer Simulated Worlds
|
53 |
|
54 |
+
1. 7 Days To Die PC
|
55 |
+
2. ARK: Survival Evolved PC
|
56 |
+
3. Arma 3 PC
|
57 |
+
4. Atlas PC
|
58 |
+
5. Conan Exiles PC
|
59 |
+
6. Craftopia PC
|
60 |
+
7. DayZ PC
|
61 |
+
8. Eco - Global Survival PC
|
62 |
+
9. Empyrion - Galactic Survival PC
|
63 |
+
10. Factorio PC
|
64 |
+
11. Farming Simulator 19 PC
|
65 |
12. Crossplay
|
66 |
+
13. Farming Simulator 22
|
67 |
+
14. Last Oasis PC
|
68 |
+
15. Last Oasis Classic PC
|
69 |
+
16. Minecraft (Vanilla) PC
|
70 |
17. Crossplay
|
71 |
18. Path of Titans
|
72 |
+
19. Rust PC
|
73 |
+
20. SCP: Secret Laboratory PC
|
74 |
21. SCUM PC
|
75 |
22. Satisfactory PC
|
76 |
+
23. Satisfactory (Experimental) PC
|
77 |
24. Crossplay
|
78 |
+
25. Space Engineers
|
79 |
+
26. Terraria (tShock & Vanilla) PC
|
80 |
+
27. The Forest PC
|
81 |
28. Crossplay
|
82 |
29. Valheim
|
83 |
"""
|
|
|
96 |
def display_terms_with_links(terms):
|
97 |
def generate_arxiv_link(term):
|
98 |
params = {'term': term}
|
99 |
+
base_url = st.experimental_get_url().split('?')[0]
|
100 |
+
query_string = urlencode(params)
|
101 |
+
full_url = f"{base_url}?{query_string}"
|
102 |
+
return full_url
|
103 |
|
104 |
search_urls = {
|
105 |
"🚀🌌ArXiv": lambda k: generate_arxiv_link(k),
|
|
|
180 |
# Function to process query parameters and handle AI lookup
|
181 |
def process_query_parameters():
|
182 |
query_params = st.experimental_get_query_params()
|
183 |
+
term = query_params.get('term', None)
|
184 |
+
if term:
|
185 |
+
term = term[0] # Get the first value
|
186 |
if len(term) > 1:
|
187 |
st.write(f"### Search term received: {term}")
|
188 |
# Perform AI lookup
|
|
|
201 |
# Update session state
|
202 |
st.session_state.selected_file = filename
|
203 |
st.session_state.view_mode = 'view'
|
|
|
|
|
204 |
|
205 |
# Sidebar for file management
|
206 |
def file_management_sidebar():
|
|
|
237 |
st.sidebar.success(f"Created new file: {new_filename}")
|
238 |
st.session_state.selected_file = new_filename
|
239 |
st.session_state.view_mode = 'edit'
|
|
|
240 |
else:
|
241 |
st.sidebar.write("No markdown files found.")
|
242 |
if st.sidebar.button("Create New Markdown File"):
|
|
|
248 |
st.sidebar.success(f"Created new file: {new_filename}")
|
249 |
st.session_state.selected_file = new_filename
|
250 |
st.session_state.view_mode = 'edit'
|
|
|
251 |
|
252 |
# Main application logic
|
253 |
def main():
|
|
|
290 |
# File management sidebar
|
291 |
file_management_sidebar()
|
292 |
|
|
|
|
|
|
|
|
|
|
|
293 |
# Display the selected file
|
294 |
selected_file = st.session_state.get('selected_file')
|
295 |
if selected_file:
|