diff --git a/server/visualdl/mock/data.py b/server/visualdl/mock/data.py index bca178f478a4848fd3a08544488a376fcd7f8263..35284d2b0ca6a1a693f71c581327f233f5a507e3 100644 --- a/server/visualdl/mock/data.py +++ b/server/visualdl/mock/data.py @@ -99,3 +99,130 @@ def sequence_data(): ], [1465980671.173917, 108, 0.7400000095367432], [ 1465980671.205898, 109, 0.8799999952316284 ], [1465980671.833723, 111, 0.9100000262260437]] + + +def graph_data(): + return """{ + "title": { + "text": "MLP" + }, + "tooltip": {}, + "animationDurationUpdate": 1500, + "animationEasingUpdate": "quinticInOut", + "series": [ + { + "type": "graph", + "layout": "none", + "symbolSize": 50, + "roam": true, + "label": { + "normal": { + "show": true + } + }, + "edgeSymbol": [ + "circle", + "arrow" + ], + "edgeSymbolSize": [ + 4, + 10 + ], + "edgeLabel": { + "normal": { + "textStyle": { + "fontSize": 20 + } + } + }, + "data": [ + { + "name": "X", + "x": 450, + "y": 600 + }, + { + "name": "W1", + "x": 750, + "y": 600 + }, + { + "name": "B1", + "x": 650, + "y": 600 + }, + { + "name": "W2", + "x": 650, + "y": 800 + }, + { + "name": "B2", + "x": 750, + "y": 800 + }, + { + "name": "FC1", + "x": 550, + "y": 700 + }, + { + "name": "RELU", + "x": 550, + "y": 800 + }, + { + "name": "FC2", + "x": 550, + "y": 900 + }, + { + "name": "Y", + "x": 550, + "y": 1000 + } + ], + "links": [ + { + "source": "X", + "target": "FC1" + }, + { + "source": "W1", + "target": "FC1" + }, + { + "source": "B1", + "target": "FC1" + }, + { + "source": "FC1", + "target": "RELU" + }, + { + "source": "RELU", + "target": "FC2" + }, + { + "source": "W2", + "target": "FC2" + }, + { + "source": "B2", + "target": "FC2" + }, + { + "source": "FC2", + "target": "Y" + } + ], + "lineStyle": { + "normal": { + "opacity": 0.9, + "width": 2, + "curveness": 0 + } + } + } + ] +}""" \ No newline at end of file diff --git a/server/visualdl/visual_dl.py b/server/visualdl/visual_dl.py index 9b6c68e71bf0d48b330c2d44659f180ef6657cfe..5fa1c3aa5ee48fe6f0d13e41f4c75b4255c58dd4 100644 --- a/server/visualdl/visual_dl.py +++ b/server/visualdl/visual_dl.py @@ -168,8 +168,12 @@ def histogram(): @app.route('/data/plugin/graphs/graph') def graph(): - model_json = graph.load_model("") - return Response(model_json, mimetype='application/json') + # run = request.args.get('run') + # model_json = graph.load_model("") + model_json_str = mock_data.graph_data() + model_json = json.loads(model_json_str) + result = gen_result(0, "", model_json) + return Response(json.dumps(result), mimetype='application/json') if __name__ == '__main__':