Skip to content

Commit

Permalink
Update medapp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudhendra committed Oct 21, 2024
1 parent b464cb0 commit 006241f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions medapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,8 @@ def mindmap_tab_content(video_data):

if st.session_state.get('mindmap_structure'):
mermaid_code = convert_to_mermaid(st.session_state.mindmap_structure)
st.markdown(f"""
```mermaid
{mermaid_code}
```
""")
html = mermaid_to_html(mermaid_code)
st.components.v1.html(html, height=600)

st.subheader("Mindmap Analysis")
if st.session_state.mindmap_analysis:
Expand Down Expand Up @@ -344,5 +341,12 @@ def disclosures_tab_content():
disclosures_content = f.read()
st.markdown(disclosures_content)

def mermaid_to_html(mermaid_code):
encoded_mermaid = base64.b64encode(mermaid_code.encode('utf-8')).decode('utf-8')
html = f'''
<iframe width="100%" height="600px" src="https://mermaid.live/edit#base64:{encoded_mermaid}"></iframe>
'''
return html

if __name__ == "__main__":
main()

0 comments on commit 006241f

Please sign in to comment.