This commit is contained in:
2022-11-30 14:59:29 +01:00
parent 92fc48d1f5
commit 5cb6dba886

16
main.py
View File

@@ -14,14 +14,6 @@ config = {
class Root(object):
def answer_question(self, question, context):
question_answerer = pipeline('question-answering', model=model_name, tokenizer=model_name)
answer = question_answerer({'question': question, 'context': context})
print(answer)
return answer["answer"]
@cherrypy.expose
def index(self, *args, **kwargs):
answer = ""
@@ -37,14 +29,6 @@ class Root(object):
return "<html><head><title>reinout project 1</title></head><body><h1>question</h1><form method=\"POST\" action=\"index\"><input type=\"text\" name=\"question\" size=\"50\"/><button type=\"submit\">send!</button></form>{}</body></html>".format(answer)
@cherrypy.expose
def question(self, *args,**kwargs):
with open('data.txt') as f:
alles = f.read()
f.close()
string=self.answer_question(cherrypy.request.params.get('the_link'), alles)
return string
if __name__ == '__main__':
cherrypy.quickstart(Root(), '/', config)