def execute_pipeline(query): df = pd.read_csv('data/bnpp_newsroom_v1.1/bnpp_newsroom-v1.1.csv', converters={'paragraphs': literal_eval}) df = filter_paragraphs(df) cdqa_pipeline = QAPipeline( reader='models/bert_qa_vCPU-sklearn.joblib') cdqa_pipeline.fit(X=df) cdqa_pipeline.reader.output_dir = None prediction = cdqa_pipeline.predict(X=query) result = (prediction[0], prediction[1]) return result
import os import pandas as pd from ast import literal_eval import cdqa from cdqa.utils.filters import filter_paragraphs from cdqa.pipeline.cdqa_sklearn import QAPipeline df = pd.read_csv('/home/ubuntu/data/bnpp_newsroom_v1.1/bnpp_newsroom-v1.1.csv', converters={'paragraphs': literal_eval}) df = filter_paragraphs(df) df['title'] = df['category'] cdqa_pipeline = QAPipeline( reader='/home/ubuntu/data/bert_qa_vCPU-sklearn.joblib') cdqa_pipeline.fit(X=df) print('At result') class QAModule(): def __init__(self): self.query = 'Since when does the Excellence Program of BNP Paribas exist?' def getAnswer(self, query): prediction = cdqa_pipeline.predict(X=query) return prediction class SentimentModule(): def __init__(self):