Skip to content
Snippets Groups Projects
Commit ae9497ac authored by Marc Roig Vilamala's avatar Marc Roig Vilamala
Browse files

Added API endpoint for stance function

parent c65257d3
Branches c_stance
No related tags found
No related merge requests found
from flask import make_response, jsonify
from func.ner.ner import *
from func.nlp_stance.nlp_stance import run_nlp_stance_on_text
from func.sentiment.sentiment import *
from func.translation.translation import run_translation_on_text
from func.usas.usas import *
......@@ -132,4 +133,12 @@ def get_dataset_ids():
if result["code"] == "SUCCESS":
return make_response(jsonify(result), 200)
return make_response(jsonify(result), 400)
\ No newline at end of file
return make_response(jsonify(result), 400)
def run_nlp_stance(table, dataset_id):
result = run_nlp_stance_on_text(table, dataset_id)
if result["code"] == "SUCCESS":
return make_response(jsonify(result), 201)
return make_response(jsonify(result), 400)
......@@ -123,4 +123,16 @@ def getfiles():
page = request_data['dataset_id']
result = get_files_all(page)
return result
\ No newline at end of file
return result
@app.route("/nlpStance", methods=['POST'])
def nlp_stance():
request_data = request.get_json()
result = run_nlp_stance(
table=request_data['table'],
dataset_id=request_data['dataset_id']
)
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment