File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ * .pyc
12/.bsp /
23/.idea /
34
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ from flask import Flask , jsonify , request
4+
5+ from graphs import MyGraph
6+
7+ app = Flask (__name__ )
8+
9+ graph = MyGraph ()
10+ query_count = 0
11+
12+ @app .route ('/select' , methods = ['POST' ])
13+ def do_select ():
14+ global graph
15+ global query_count
16+ query_count += 1
17+ rq = request .json
18+ name = rq ['problemName' ]
19+ graph .generate (int (name ))
20+ return jsonify ({'problemName' : name })
21+
22+ @app .route ('/explore' , methods = ['POST' ])
23+ def do_explore ():
24+ global graph
25+ global query_count
26+ rq = request .json
27+ plans = rq ['plans' ]
28+ results = []
29+ for plan in plans :
30+ gates = [int (g ) for g in plan ]
31+ labels = graph .explore (gates )
32+ results .append (labels )
33+ rs = {'results' : results , 'queryCount' : query_count }
34+ return jsonify (rs )
35+
36+ if __name__ == "__main__" :
37+ app .run (debug = True )
38+
You can’t perform that action at this time.
0 commit comments