Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,18 @@ import networkx as nx
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
from pyvis.network import Network
|
| 6 |
import got
|
| 7 |
-
#Network(notebook=True)
|
| 8 |
st.title('Hello Pyvis')
|
|
|
|
|
|
|
| 9 |
# make Network show itself with repr_html
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#Network._repr_html_ = net_repr_html
|
| 17 |
st.sidebar.title('Choose your favorite Graph')
|
| 18 |
option=st.sidebar.selectbox('select graph',('Simple','Karate', 'GOT'))
|
| 19 |
physics=st.sidebar.checkbox('add physics interactivity?')
|
|
@@ -24,7 +26,6 @@ if option=='Simple':
|
|
| 24 |
source_code = HtmlFile.read()
|
| 25 |
components.html(source_code, height = 900,width=900)
|
| 26 |
|
| 27 |
-
|
| 28 |
got.got_func(physics)
|
| 29 |
|
| 30 |
if option=='GOT':
|
|
@@ -32,8 +33,6 @@ if option=='GOT':
|
|
| 32 |
source_code = HtmlFile.read()
|
| 33 |
components.html(source_code, height = 1200,width=1000)
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
got.karate_func(physics)
|
| 38 |
|
| 39 |
if option=='Karate':
|
|
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
from pyvis.network import Network
|
| 6 |
import got
|
|
|
|
| 7 |
st.title('Hello Pyvis')
|
| 8 |
+
|
| 9 |
+
Network(notebook=True)
|
| 10 |
# make Network show itself with repr_html
|
| 11 |
|
| 12 |
+
def net_repr_html(self):
|
| 13 |
+
nodes, edges, height, width, options = self.get_network_data()
|
| 14 |
+
html = self.template.render(height=height, width=width, nodes=nodes, edges=edges, options=options)
|
| 15 |
+
return html
|
| 16 |
+
|
| 17 |
+
Network._repr_html_ = net_repr_html
|
| 18 |
|
|
|
|
| 19 |
st.sidebar.title('Choose your favorite Graph')
|
| 20 |
option=st.sidebar.selectbox('select graph',('Simple','Karate', 'GOT'))
|
| 21 |
physics=st.sidebar.checkbox('add physics interactivity?')
|
|
|
|
| 26 |
source_code = HtmlFile.read()
|
| 27 |
components.html(source_code, height = 900,width=900)
|
| 28 |
|
|
|
|
| 29 |
got.got_func(physics)
|
| 30 |
|
| 31 |
if option=='GOT':
|
|
|
|
| 33 |
source_code = HtmlFile.read()
|
| 34 |
components.html(source_code, height = 1200,width=1000)
|
| 35 |
|
|
|
|
|
|
|
| 36 |
got.karate_func(physics)
|
| 37 |
|
| 38 |
if option=='Karate':
|