exact_data2023/application/services/irony_service.py

19 lines
555 B
Python
Raw Normal View History

2023-06-10 01:51:01 +02:00
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})