File size: 1,051 Bytes
b2841f8
 
 
a177e53
b2841f8
a177e53
b2841f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a177e53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2841f8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from flask import Flask, request
from flask_restful import Resource, Api, reqparse
from flask_cors import CORS
from encoder_file import get_encoder

encoder = get_encoder()
app = Flask(__name__)
CORS(app)
api = Api(app)
parser = reqparse.RequestParser()

class Status(Resource):
    def get(self):
        return {'status': 'Server Running Successfully'}


DATASET_CONSTANT = {
    "data": [
        "dataset-1",
        "dataset-2",
        "dataset-3",
        "dataset-4",
        "dataset-5"
    ]
}   

class Data(Resource):
    def get(self):
        return DATASET_CONSTANT

api.add_resource(Status, '/')
api.add_resource(Data, '/data')


@app.route('/get_sample',methods=['POST'])
def _inference():
    
    try:
        info    = request.json["data"]
        return jsonify({"result" : encoder.encode(info)})

    except Exception as e:
        print(e)
        return jsonify({"result":"-1"}) 

@app.route('/checking',methods=['GET'])
def check():
    return jsonify({"status": 'working'})

if __name__ == '__main__':
    app.run(debug=True)