ARAI/Backend_correct/app.py

49 lines
1.3 KiB
Python
Raw Normal View History

from flask import Flask, request, jsonify
2024-03-09 18:33:01 +01:00
from flask_cors import CORS, cross_origin
app = Flask(__name__)
2024-03-09 18:33:01 +01:00
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
2024-03-09 18:33:01 +01:00
@cross_origin()
2024-03-09 18:58:36 +01:00
@app.route("/", methods=['POST'])
def recommended_mediators():
data = request.get_json()
2024-03-09 15:25:21 +01:00
2024-03-09 18:28:39 +01:00
input = data.get('request_data', {})
# print(input.get("location"))
2024-03-09 15:25:21 +01:00
top_5 = {
"response_type": "recommended_mediators",
2024-03-09 15:25:21 +01:00
"response_data": [{
"cost_of_trial": 5000,
"time_of_trial": 70
}, [{
"name": "Mateusz Szpyruk",
"specialization": "Prawo podatkowe",
2024-03-09 18:28:39 +01:00
"location": input.get("location"),
2024-03-09 15:25:21 +01:00
"ai_rating": 99,
"user_rating": 99,
"number_of_opinions": 5
}, {
"name": "Jan Kowalski",
"specialization": "Prawo pracy",
2024-03-09 18:28:39 +01:00
"location": input.get("location"),
2024-03-09 15:25:21 +01:00
"ai_rating": 90,
"user_rating": 99,
"number_of_opinions": 5
}, {
"name": "Jan Kowalski",
"specialization": "Prawo pracy",
2024-03-09 18:28:39 +01:00
"location": input.get("location"),
2024-03-09 15:25:21 +01:00
"ai_rating": 90,
"user_rating": 99,
"number_of_opinions": 5
}]]
}
2024-03-09 15:25:21 +01:00
return jsonify(top_5)
if __name__ == '__main__':
app.run(debug=True)