代码拉取完成,页面将自动刷新
同步操作将从 人工智能/医疗知识问答 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from question_classifier import *
from question_parser import *
from answer_search import *
from flask import Flask, request, session, send_file
app = Flask(__name__,static_url_path='')
app.config['SECRET_KEY'] = 'qakb123456'
'''问答类'''
class ChatBotGraph:
def __init__(self):
# question_classifier.py里的 QuestionClassifier:
self.classifier = QuestionClassifier()
#question_paser.py里的 QuestionPaser:
self.parser = QuestionPaser()
#answer_search.py里的AnswerSearcher:
self.searcher = AnswerSearcher()
self.classify = {
"diseases": ["{}是什么","{}有什么症状","{}的原因","{}的并发症","{}能吃什么","{}不能吃什么","{}吃什么药","{}怎么预防","{}多长时间会好","{}怎么治疗","{}多大概率能治好","{}的易感人群","{}的检查项目","{}属于什么科"],
"food": ["吃{}有什么好处"],
"drug": ["吃{}治疗什么"],
"symptom": ["为什么会{}"]
}
# self.history_entity = None
# self.disease_classify = ["{}是什么","{}有什么症状","{}的原因","{}的并发症","{}能吃什么","{}不能吃什么","{}吃什么药","{}怎么预防","{}多长时间会好","{}怎么治疗","{}多大概率能治好","{}的易感人群","{}的检查项目","{}属于什么科"]
# self.food_classify = ["吃{}有什么好处"]
# self.drug_classify = ["吃{}治疗什么"]
# self.symptom_classify = ["为什么会{}"]
def chat_main(self, sent,session):
answer = '您好,我是医药智能助理,希望可以帮到您。目前问题还无法回答,请用更简洁的话来问哟~'
return answer
handler = ChatBotGraph()
@app.route('/',methods=['GET'])
def home():
return send_file("static/index.html")
@app.route('/input',methods=['POST'])
def hello_world():
text = request.form.get("text")
return {'send':'you','msg':handler.chat_main(text,session)}
if __name__ == '__main__':
app.run(port=10086)
# handler = ChatBotGraph()
# while 1:
# question = input('用户:')
# answer = handler.chat_main(question)
# print('小勇:', answer)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。