Commit 507a36d6 authored by lishen's avatar lishen

[add] gradio

parent 61314e57
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# Author: lhy<lhy_in_blcu@126.com,https://huangyong.github.io> # Author: lhy<lhy_in_blcu@126.com,https://huangyong.github.io>
# Date: 18-10-4 # Date: 18-10-4
import gradio as gr
from py2neo import Graph from py2neo import Graph
from question_classifier import * from question_classifier import *
from question_parser import * from question_parser import *
...@@ -35,9 +36,18 @@ class ChatBotGraph: ...@@ -35,9 +36,18 @@ class ChatBotGraph:
return '\n'.join(final_answers) return '\n'.join(final_answers)
# if __name__ == '__main__':
# handler = ChatBotGraph()
# while 1:
# question = input('用户:')
# answer = handler.chat_main(question)
# print('小益:', answer)
if __name__ == '__main__': if __name__ == '__main__':
handler = ChatBotGraph() handler = ChatBotGraph()
while 1: # 接口创建函数
question = input('用户:') # fn设置处理函数,inputs设置输入接口组件,outputs设置输出接口组件
answer = handler.chat_main(question) # fn,inputs,outputs都是必填函数
print('小益:', answer) demo = gr.Interface(fn=handler.chat_main, inputs="text", outputs="text")
demo.launch(share=True)
没有
防止
不再
不会
不能
禁止
防止
难以
忘记
忽视
放弃
拒绝
杜绝
不是
并未
并无
仍未
难以出现
切勿
不要
不可
管住
注意
小心
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment