awacke1 commited on
Commit
6cf2b7a
·
verified ·
1 Parent(s): 5401d3f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +68 -0
app.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Mermaid diagram in Markdown
4
+ mermaid_diagram = '''
5
+ graph TD;
6
+ A[Resting Potential] --> B[Depolarization];
7
+ B --> C[Repolarization];
8
+
9
+ subgraph Neuron_Axon
10
+ direction_of_impulse[Direction of Nerve Impulse]
11
+ positive_ions[Positive Ions Rush In] --> depolarization_membrane[Membrane Channels Open];
12
+ depolarization_membrane --> positive_outside[Excess Positive Ions Outside];
13
+ repolarization_membrane[Membrane Pumps Positive Ions Out] --> excess_positive_inside[Excess Positive Ions Inside];
14
+ end
15
+
16
+ neurotransmitters[Neurotransmitters Role] --> excitatory[Excitatory Effect]
17
+ neurotransmitters --> inhibitory[Inhibitory Effect]
18
+
19
+ classDef process fill:#f9f,stroke:#333,stroke-width:2px;
20
+ class A,B,C process;
21
+ '''
22
+
23
+ # JSON representation of the diagram
24
+ diagram_json = {
25
+ "diagram": {
26
+ "nodes": [
27
+ { "id": "A", "label": "Resting Potential", "class": "process" },
28
+ { "id": "B", "label": "Depolarization", "class": "process" },
29
+ { "id": "C", "label": "Repolarization", "class": "process" },
30
+ { "id": "direction_of_impulse", "label": "Direction of Nerve Impulse" },
31
+ { "id": "positive_ions", "label": "Positive Ions Rush In" },
32
+ { "id": "depolarization_membrane", "label": "Membrane Channels Open" },
33
+ { "id": "positive_outside", "label": "Excess Positive Ions Outside" },
34
+ { "id": "repolarization_membrane", "label": "Membrane Pumps Positive Ions Out" },
35
+ { "id": "excess_positive_inside", "label": "Excess Positive Ions Inside" },
36
+ { "id": "neurotransmitters", "label": "Neurotransmitters Role" },
37
+ { "id": "excitatory", "label": "Excitatory Effect" },
38
+ { "id": "inhibitory", "label": "Inhibitory Effect" }
39
+ ],
40
+ "edges": [
41
+ { "source": "A", "target": "B" },
42
+ { "source": "B", "target": "C" },
43
+ { "source": "positive_ions", "target": "depolarization_membrane" },
44
+ { "source": "depolarization_membrane", "target": "positive_outside" },
45
+ { "source": "repolarization_membrane", "target": "excess_positive_inside" },
46
+ { "source": "neurotransmitters", "target": "excitatory" },
47
+ { "source": "neurotransmitters", "target": "inhibitory" }
48
+ ],
49
+ "styles": {
50
+ "process": {
51
+ "fill": "#f9f",
52
+ "stroke": "#333",
53
+ "stroke-width": "2px"
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ # Streamlit rendering of Mermaid diagram and JSON
60
+ st.title("Neuron Action Potential Diagram")
61
+
62
+ # Mermaid Diagram
63
+ st.subheader("Mermaid Diagram")
64
+ st.markdown(f"```mermaid\n{mermaid_diagram}\n```")
65
+
66
+ # JSON Representation
67
+ st.subheader("JSON Representation")
68
+ st.json(diagram_json)