Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,5 +85,21 @@ def app():
|
|
| 85 |
agraph(list(marvel_store.getNodes()), (marvel_store.getEdges()), config)
|
| 86 |
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
if __name__ == '__main__':
|
| 89 |
app()
|
|
|
|
| 85 |
agraph(list(marvel_store.getNodes()), (marvel_store.getEdges()), config)
|
| 86 |
|
| 87 |
|
| 88 |
+
if query_type=="Fraud":
|
| 89 |
+
#based on http://marvel-force-chart.surge.sh/
|
| 90 |
+
with open("data/fraud.json", encoding="utf8") as f:
|
| 91 |
+
marvel_file = json.loads(f.read())
|
| 92 |
+
marvel_store = TripleStore()
|
| 93 |
+
for sub_graph in marvel_file["children"]:
|
| 94 |
+
marvel_store.add_triple(marvel_file["name"], "has_subgroup", sub_graph["name"], picture=marvel_file["img"])
|
| 95 |
+
for node in sub_graph["children"]:
|
| 96 |
+
node1 = node["hero"]
|
| 97 |
+
link = "blongs_to"
|
| 98 |
+
node2 = sub_graph["name"]
|
| 99 |
+
pic = node["img"]
|
| 100 |
+
marvel_store.add_triple(node1, link, node2, picture=pic)
|
| 101 |
+
agraph(list(marvel_store.getNodes()), (marvel_store.getEdges()), config)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
if __name__ == '__main__':
|
| 105 |
app()
|