from flask import( request, jsonify, Blueprint, ) from application.functions.irony import irony_prediction irony_service = Blueprint("irony_service", __name__) @irony_service.route("/get_irony_data", methods=['POST']) def get_data(): data = request.get_json() predicitons = irony_prediction(data['sentences']) for i in range(0, len(predicitons)): predicitons[i]['sentence'] = data['sentences'][i] predicitons[i]['label'] = predicitons[i]['label'][6:] return jsonify({"predictions": predicitons})