Spaces:
Build error
Build error
update
Browse files- .vscode/settings.json +3 -3
- 1643364695510.8708.html +116 -0
- 1643368448366.303.html +116 -0
- 1643368606037.2578.html +116 -0
- 1643369883907.5068.html +116 -0
- app.py +10 -5
.vscode/settings.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"workbench.colorCustomizations": {
|
3 |
-
"activityBar.background": "#
|
4 |
-
"titleBar.activeBackground": "#
|
5 |
-
"titleBar.activeForeground": "#
|
6 |
}
|
7 |
}
|
|
|
1 |
{
|
2 |
"workbench.colorCustomizations": {
|
3 |
+
"activityBar.background": "#09323E",
|
4 |
+
"titleBar.activeBackground": "#0C4656",
|
5 |
+
"titleBar.activeForeground": "#F6FCFE"
|
6 |
}
|
7 |
}
|
1643364695510.8708.html
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 700px;
|
16 |
+
height: 700px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// parsing and collecting nodes and edges from the python
|
53 |
+
nodes = new vis.DataSet([{"id": "tasmania", "label": "tasmania", "shape": "circle"}, {"id": "australia", "label": "australia", "shape": "circle"}]);
|
54 |
+
edges = new vis.DataSet([{"arrows": "to", "from": "australia", "label": "contains administrative territorial entity", "title": "contains administrative territorial entity", "to": "tasmania"}, {"arrows": "to", "from": "tasmania", "label": "located in the administrative territorial entity", "title": "located in the administrative territorial entity", "to": "australia"}]);
|
55 |
+
|
56 |
+
// adding nodes and edges to the graph
|
57 |
+
data = {nodes: nodes, edges: edges};
|
58 |
+
|
59 |
+
var options = {
|
60 |
+
"configure": {
|
61 |
+
"enabled": false
|
62 |
+
},
|
63 |
+
"edges": {
|
64 |
+
"color": {
|
65 |
+
"inherit": true
|
66 |
+
},
|
67 |
+
"smooth": {
|
68 |
+
"enabled": true,
|
69 |
+
"type": "dynamic"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"interaction": {
|
73 |
+
"dragNodes": true,
|
74 |
+
"hideEdgesOnDrag": false,
|
75 |
+
"hideNodesOnDrag": false
|
76 |
+
},
|
77 |
+
"physics": {
|
78 |
+
"enabled": true,
|
79 |
+
"repulsion": {
|
80 |
+
"centralGravity": 0.2,
|
81 |
+
"damping": 0.09,
|
82 |
+
"nodeDistance": 200,
|
83 |
+
"springConstant": 0.05,
|
84 |
+
"springLength": 200
|
85 |
+
},
|
86 |
+
"solver": "repulsion",
|
87 |
+
"stabilization": {
|
88 |
+
"enabled": true,
|
89 |
+
"fit": true,
|
90 |
+
"iterations": 1000,
|
91 |
+
"onlyDynamicEdges": false,
|
92 |
+
"updateInterval": 50
|
93 |
+
}
|
94 |
+
}
|
95 |
+
};
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
network = new vis.Network(container, data, options);
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
return network;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
drawGraph();
|
113 |
+
|
114 |
+
</script>
|
115 |
+
</body>
|
116 |
+
</html>
|
1643368448366.303.html
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 700px;
|
16 |
+
height: 700px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// parsing and collecting nodes and edges from the python
|
53 |
+
nodes = new vis.DataSet([{"id": "software testing", "label": "software testing", "shape": "circle"}, {"id": "software under test", "label": "software under test", "shape": "circle"}]);
|
54 |
+
edges = new vis.DataSet([{"arrows": "to", "from": "software under test", "label": "subclass of", "title": "subclass of", "to": "software testing"}]);
|
55 |
+
|
56 |
+
// adding nodes and edges to the graph
|
57 |
+
data = {nodes: nodes, edges: edges};
|
58 |
+
|
59 |
+
var options = {
|
60 |
+
"configure": {
|
61 |
+
"enabled": false
|
62 |
+
},
|
63 |
+
"edges": {
|
64 |
+
"color": {
|
65 |
+
"inherit": true
|
66 |
+
},
|
67 |
+
"smooth": {
|
68 |
+
"enabled": true,
|
69 |
+
"type": "dynamic"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"interaction": {
|
73 |
+
"dragNodes": true,
|
74 |
+
"hideEdgesOnDrag": false,
|
75 |
+
"hideNodesOnDrag": false
|
76 |
+
},
|
77 |
+
"physics": {
|
78 |
+
"enabled": true,
|
79 |
+
"repulsion": {
|
80 |
+
"centralGravity": 0.2,
|
81 |
+
"damping": 0.09,
|
82 |
+
"nodeDistance": 200,
|
83 |
+
"springConstant": 0.05,
|
84 |
+
"springLength": 200
|
85 |
+
},
|
86 |
+
"solver": "repulsion",
|
87 |
+
"stabilization": {
|
88 |
+
"enabled": true,
|
89 |
+
"fit": true,
|
90 |
+
"iterations": 1000,
|
91 |
+
"onlyDynamicEdges": false,
|
92 |
+
"updateInterval": 50
|
93 |
+
}
|
94 |
+
}
|
95 |
+
};
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
network = new vis.Network(container, data, options);
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
return network;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
drawGraph();
|
113 |
+
|
114 |
+
</script>
|
115 |
+
</body>
|
116 |
+
</html>
|
1643368606037.2578.html
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 700px;
|
16 |
+
height: 700px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// parsing and collecting nodes and edges from the python
|
53 |
+
nodes = new vis.DataSet([{"id": "software testing", "label": "software testing", "shape": "circle"}, {"id": "software under test", "label": "software under test", "shape": "circle"}]);
|
54 |
+
edges = new vis.DataSet([{"arrows": "to", "from": "software under test", "label": "subclass of", "title": "subclass of", "to": "software testing"}]);
|
55 |
+
|
56 |
+
// adding nodes and edges to the graph
|
57 |
+
data = {nodes: nodes, edges: edges};
|
58 |
+
|
59 |
+
var options = {
|
60 |
+
"configure": {
|
61 |
+
"enabled": false
|
62 |
+
},
|
63 |
+
"edges": {
|
64 |
+
"color": {
|
65 |
+
"inherit": true
|
66 |
+
},
|
67 |
+
"smooth": {
|
68 |
+
"enabled": true,
|
69 |
+
"type": "dynamic"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"interaction": {
|
73 |
+
"dragNodes": true,
|
74 |
+
"hideEdgesOnDrag": false,
|
75 |
+
"hideNodesOnDrag": false
|
76 |
+
},
|
77 |
+
"physics": {
|
78 |
+
"enabled": true,
|
79 |
+
"repulsion": {
|
80 |
+
"centralGravity": 0.2,
|
81 |
+
"damping": 0.09,
|
82 |
+
"nodeDistance": 200,
|
83 |
+
"springConstant": 0.05,
|
84 |
+
"springLength": 200
|
85 |
+
},
|
86 |
+
"solver": "repulsion",
|
87 |
+
"stabilization": {
|
88 |
+
"enabled": true,
|
89 |
+
"fit": true,
|
90 |
+
"iterations": 1000,
|
91 |
+
"onlyDynamicEdges": false,
|
92 |
+
"updateInterval": 50
|
93 |
+
}
|
94 |
+
}
|
95 |
+
};
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
network = new vis.Network(container, data, options);
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
return network;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
drawGraph();
|
113 |
+
|
114 |
+
</script>
|
115 |
+
</body>
|
116 |
+
</html>
|
1643369883907.5068.html
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
|
4 |
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
|
5 |
+
<center>
|
6 |
+
<h1></h1>
|
7 |
+
</center>
|
8 |
+
|
9 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
10 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
11 |
+
|
12 |
+
<style type="text/css">
|
13 |
+
|
14 |
+
#mynetwork {
|
15 |
+
width: 700px;
|
16 |
+
height: 700px;
|
17 |
+
background-color: #ffffff;
|
18 |
+
border: 1px solid lightgray;
|
19 |
+
position: relative;
|
20 |
+
float: left;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
</style>
|
29 |
+
|
30 |
+
</head>
|
31 |
+
|
32 |
+
<body>
|
33 |
+
<div id = "mynetwork"></div>
|
34 |
+
|
35 |
+
|
36 |
+
<script type="text/javascript">
|
37 |
+
|
38 |
+
// initialize global variables.
|
39 |
+
var edges;
|
40 |
+
var nodes;
|
41 |
+
var network;
|
42 |
+
var container;
|
43 |
+
var options, data;
|
44 |
+
|
45 |
+
|
46 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
47 |
+
function drawGraph() {
|
48 |
+
var container = document.getElementById('mynetwork');
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// parsing and collecting nodes and edges from the python
|
53 |
+
nodes = new vis.DataSet([{"id": "software testing", "label": "software testing", "shape": "circle"}, {"id": "software under test", "label": "software under test", "shape": "circle"}]);
|
54 |
+
edges = new vis.DataSet([{"arrows": "to", "from": "software under test", "label": "subclass of", "title": "subclass of", "to": "software testing"}]);
|
55 |
+
|
56 |
+
// adding nodes and edges to the graph
|
57 |
+
data = {nodes: nodes, edges: edges};
|
58 |
+
|
59 |
+
var options = {
|
60 |
+
"configure": {
|
61 |
+
"enabled": false
|
62 |
+
},
|
63 |
+
"edges": {
|
64 |
+
"color": {
|
65 |
+
"inherit": true
|
66 |
+
},
|
67 |
+
"smooth": {
|
68 |
+
"enabled": true,
|
69 |
+
"type": "dynamic"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"interaction": {
|
73 |
+
"dragNodes": true,
|
74 |
+
"hideEdgesOnDrag": false,
|
75 |
+
"hideNodesOnDrag": false
|
76 |
+
},
|
77 |
+
"physics": {
|
78 |
+
"enabled": true,
|
79 |
+
"repulsion": {
|
80 |
+
"centralGravity": 0.2,
|
81 |
+
"damping": 0.09,
|
82 |
+
"nodeDistance": 200,
|
83 |
+
"springConstant": 0.05,
|
84 |
+
"springLength": 200
|
85 |
+
},
|
86 |
+
"solver": "repulsion",
|
87 |
+
"stabilization": {
|
88 |
+
"enabled": true,
|
89 |
+
"fit": true,
|
90 |
+
"iterations": 1000,
|
91 |
+
"onlyDynamicEdges": false,
|
92 |
+
"updateInterval": 50
|
93 |
+
}
|
94 |
+
}
|
95 |
+
};
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
network = new vis.Network(container, data, options);
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
return network;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
drawGraph();
|
113 |
+
|
114 |
+
</script>
|
115 |
+
</body>
|
116 |
+
</html>
|
app.py
CHANGED
@@ -15,7 +15,7 @@ import os
|
|
15 |
|
16 |
|
17 |
wiki_state_variables = {
|
18 |
-
'
|
19 |
'wiki_suggestions': [],
|
20 |
'wiki_text' : [],
|
21 |
'nodes':[],
|
@@ -23,7 +23,7 @@ wiki_state_variables = {
|
|
23 |
}
|
24 |
|
25 |
free_text_state_variables = {
|
26 |
-
'
|
27 |
}
|
28 |
|
29 |
def wiki_init_state_variables():
|
@@ -52,7 +52,7 @@ def wiki_generate_graph():
|
|
52 |
n = n.lower()
|
53 |
if n not in st.session_state['topics']:
|
54 |
st.session_state['nodes'].append(n)
|
55 |
-
st.session_state['
|
56 |
st.success('Done!')
|
57 |
|
58 |
def wiki_show_suggestion():
|
@@ -61,7 +61,7 @@ def wiki_show_suggestion():
|
|
61 |
if st.session_state['input_method'] == "wikipedia":
|
62 |
text = st.session_state.text
|
63 |
if text is not None:
|
64 |
-
subjects = text.split(",")
|
65 |
for subj in subjects:
|
66 |
st.session_state['wiki_suggestions'] += wikipedia.search(subj, results = 3)
|
67 |
|
@@ -98,7 +98,6 @@ def wiki_reset_session():
|
|
98 |
|
99 |
def free_text_generate():
|
100 |
st.session_state["GRAPH_FILENAME"] = str(dt.now().timestamp()*1000) + ".html"
|
101 |
-
|
102 |
text = st.session_state['free_text'][0:500]
|
103 |
rebel.generate_knowledge_graph([text], st.session_state["GRAPH_FILENAME"])
|
104 |
st.session_state['has_run'] = True
|
@@ -165,6 +164,8 @@ def show_wiki_hub_page():
|
|
165 |
- Hit the Generate button again to expand your graph!
|
166 |
"""
|
167 |
)
|
|
|
|
|
168 |
if st.session_state['has_run']:
|
169 |
HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
|
170 |
source_code = HtmlFile.read()
|
@@ -191,7 +192,10 @@ def show_free_text_hub_page():
|
|
191 |
|
192 |
st.sidebar.button("Reset", key="reset_key")
|
193 |
free_text_layout()
|
|
|
|
|
194 |
if st.session_state['has_run']:
|
|
|
195 |
HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
|
196 |
source_code = HtmlFile.read()
|
197 |
components.html(source_code, width=720, height=600)
|
@@ -201,6 +205,7 @@ if st.session_state['input_method'] == "wikipedia":
|
|
201 |
wiki_init_state_variables()
|
202 |
show_wiki_hub_page()
|
203 |
else:
|
|
|
204 |
show_free_text_hub_page()
|
205 |
|
206 |
|
|
|
15 |
|
16 |
|
17 |
wiki_state_variables = {
|
18 |
+
'has_run_wiki':False,
|
19 |
'wiki_suggestions': [],
|
20 |
'wiki_text' : [],
|
21 |
'nodes':[],
|
|
|
23 |
}
|
24 |
|
25 |
free_text_state_variables = {
|
26 |
+
'has_run_free':False,
|
27 |
}
|
28 |
|
29 |
def wiki_init_state_variables():
|
|
|
52 |
n = n.lower()
|
53 |
if n not in st.session_state['topics']:
|
54 |
st.session_state['nodes'].append(n)
|
55 |
+
st.session_state['has_run_wiki'] = True
|
56 |
st.success('Done!')
|
57 |
|
58 |
def wiki_show_suggestion():
|
|
|
61 |
if st.session_state['input_method'] == "wikipedia":
|
62 |
text = st.session_state.text
|
63 |
if text is not None:
|
64 |
+
subjects = text.split(",")[:5]
|
65 |
for subj in subjects:
|
66 |
st.session_state['wiki_suggestions'] += wikipedia.search(subj, results = 3)
|
67 |
|
|
|
98 |
|
99 |
def free_text_generate():
|
100 |
st.session_state["GRAPH_FILENAME"] = str(dt.now().timestamp()*1000) + ".html"
|
|
|
101 |
text = st.session_state['free_text'][0:500]
|
102 |
rebel.generate_knowledge_graph([text], st.session_state["GRAPH_FILENAME"])
|
103 |
st.session_state['has_run'] = True
|
|
|
164 |
- Hit the Generate button again to expand your graph!
|
165 |
"""
|
166 |
)
|
167 |
+
print(st.session_state)
|
168 |
+
|
169 |
if st.session_state['has_run']:
|
170 |
HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
|
171 |
source_code = HtmlFile.read()
|
|
|
192 |
|
193 |
st.sidebar.button("Reset", key="reset_key")
|
194 |
free_text_layout()
|
195 |
+
print(st.session_state)
|
196 |
+
|
197 |
if st.session_state['has_run']:
|
198 |
+
print(st.session_state)
|
199 |
HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
|
200 |
source_code = HtmlFile.read()
|
201 |
components.html(source_code, width=720, height=600)
|
|
|
205 |
wiki_init_state_variables()
|
206 |
show_wiki_hub_page()
|
207 |
else:
|
208 |
+
free_test_init_state_variables()
|
209 |
show_free_text_hub_page()
|
210 |
|
211 |
|