awacke1 commited on
Commit
4523ea2
·
verified ·
1 Parent(s): 1e585b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -10
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import streamlit.components.v1 as components
 
3
 
4
  # --------------------------
5
  # Mermaid Renderer Function
@@ -29,6 +30,24 @@ def render_mermaid(mermaid_code, height=300):
29
  """
30
  components.html(html_code, height=height)
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # --------------------------
33
  # Markdown Outlines for Each Area
34
  # --------------------------
@@ -134,10 +153,15 @@ graph LR
134
  '''
135
  }
136
 
 
 
 
 
 
 
137
  # --------------------------
138
  # Markdown Sections
139
  # --------------------------
140
-
141
  md_combined_outline = r'''
142
  # 📚 Hands On ML App. Dev. with Mixture of Experts and Multiagent Skills and State of Art ML Architecture
143
  1. 🗼LeCo👥 Leadership and Collaboration : Strategic leadership and team management.
@@ -317,6 +341,16 @@ graph TD
317
  CoOS ---|🤝 collaborates with| LeCo
318
  CoOS ---|🗣️ informs| DaEn
319
  SpDo ---|🔄 shares with| CoOS
 
 
 
 
 
 
 
 
 
 
320
  '''
321
 
322
  # --------------------------
@@ -325,17 +359,30 @@ graph TD
325
  def main():
326
  st.set_page_config(page_title="Densified Skill Tree", layout="wide")
327
 
328
- # Optionally render combined outlines and submodels if desired:
 
 
 
 
329
  st.markdown(md_combined_outline, unsafe_allow_html=True)
330
- #st.markdown(md_submodels_outline, unsafe_allow_html=True)
331
 
332
- # For each numbered area, display its markdown outline first, then its mermaid diagram.
333
- for key in sorted(markdown_areas.keys(), key=lambda k: int(k.split('.')[0])):
334
- st.markdown(markdown_areas[key], unsafe_allow_html=True)
335
- if key in mermaid_areas:
336
- render_mermaid(mermaid_areas[key], height=350)
 
 
 
 
 
 
 
 
 
 
337
 
338
- # Render the combined mermaid diagram for an overview
339
  render_mermaid(combined_mermaid, height=850)
340
 
341
  # Display additional markdown sections
@@ -346,4 +393,4 @@ def main():
346
  st.markdown(md_tweet, unsafe_allow_html=True)
347
 
348
  if __name__ == "__main__":
349
- main()
 
1
  import streamlit as st
2
  import streamlit.components.v1 as components
3
+ import urllib.parse
4
 
5
  # --------------------------
6
  # Mermaid Renderer Function
 
30
  """
31
  components.html(html_code, height=height)
32
 
33
+ # --------------------------
34
+ # Function to Add Clickable Links to Mermaid Diagrams
35
+ # --------------------------
36
+ def add_mermaid_links(mermaid_code, area_code, base_url):
37
+ """Add clickable links to Mermaid diagram nodes."""
38
+ lines = mermaid_code.split('\n')
39
+ new_lines = []
40
+ for line in lines:
41
+ new_lines.append(line)
42
+ # Check if the line defines a node (e.g., LeCo["..."])
43
+ if '[' in line and ']' in line:
44
+ node_id = line.split('[')[0].strip()
45
+ if node_id:
46
+ # Self-referential link with query parameter
47
+ safe_url = f"{base_url}/?area={area_code}#{node_id}"
48
+ new_lines.append(f' click {node_id} "{safe_url}" "View {node_id}"')
49
+ return '\n'.join(new_lines)
50
+
51
  # --------------------------
52
  # Markdown Outlines for Each Area
53
  # --------------------------
 
153
  '''
154
  }
155
 
156
+ # Update mermaid_areas with clickable links
157
+ base_url = "http://localhost:8501" # Replace with your app's base URL when deployed
158
+ for key in mermaid_areas:
159
+ area_code = key.split(' ')[-1] # Extract area code (e.g., LeCo)
160
+ mermaid_areas[key] = add_mermaid_links(mermaid_areas[key], area_code, base_url)
161
+
162
  # --------------------------
163
  # Markdown Sections
164
  # --------------------------
 
165
  md_combined_outline = r'''
166
  # 📚 Hands On ML App. Dev. with Mixture of Experts and Multiagent Skills and State of Art ML Architecture
167
  1. 🗼LeCo👥 Leadership and Collaboration : Strategic leadership and team management.
 
341
  CoOS ---|🤝 collaborates with| LeCo
342
  CoOS ---|🗣️ informs| DaEn
343
  SpDo ---|🔄 shares with| CoOS
344
+
345
+ click LeCo "/?area=LeCo" "View Leadership and Collaboration"
346
+ click SeCo "/?area=SeCo" "View Security and Compliance"
347
+ click DaEn "/?area=DaEn" "View Data Engineering"
348
+ click CoOS "/?area=CoOS" "View Community Open Source"
349
+ click FuMo "/?area=FuMo" "View FullStack UI Mobile"
350
+ click SoCM "/?area=SoCM" "View Software Cloud MLOps"
351
+ click AIML "/?area=AIML" "View AI Machine Learning"
352
+ click SyIn "/?area=SyIn" "View Systems Infrastructure"
353
+ click SpDo "/?area=SpDo" "View Specialized Domains"
354
  '''
355
 
356
  # --------------------------
 
359
  def main():
360
  st.set_page_config(page_title="Densified Skill Tree", layout="wide")
361
 
362
+ # Get query parameters
363
+ query_params = st.experimental_get_query_params()
364
+ selected_area = query_params.get("area", [None])[0]
365
+
366
+ # Display combined outline
367
  st.markdown(md_combined_outline, unsafe_allow_html=True)
 
368
 
369
+ # If an area is selected, show only that area's content
370
+ if selected_area:
371
+ for key in sorted(markdown_areas.keys(), key=lambda k: int(k.split('.')[0])):
372
+ area_code = key.split(' ')[-1] # Extract area code (e.g., LeCo, SeCo)
373
+ if area_code == selected_area:
374
+ st.markdown(markdown_areas[key], unsafe_allow_html=True)
375
+ if key in mermaid_areas:
376
+ render_mermaid(mermaid_areas[key], height=350)
377
+ break
378
+ else:
379
+ # Show all areas if no specific area is selected
380
+ for key in sorted(markdown_areas.keys(), key=lambda k: int(k.split('.')[0])):
381
+ st.markdown(markdown_areas[key], unsafe_allow_html=True)
382
+ if key in mermaid_areas:
383
+ render_mermaid(mermaid_areas[key], height=350)
384
 
385
+ # Render the Failure Analysis combined mermaid diagram
386
  render_mermaid(combined_mermaid, height=850)
387
 
388
  # Display additional markdown sections
 
393
  st.markdown(md_tweet, unsafe_allow_html=True)
394
 
395
  if __name__ == "__main__":
396
+ main()