Update app.py
Browse files
app.py
CHANGED
@@ -4,37 +4,15 @@ from chatterbot.trainers import ListTrainer
|
|
4 |
from chatterbot.trainers import ChatterBotCorpusTrainer
|
5 |
import wikipedia
|
6 |
|
7 |
-
chatbot = ChatBot("Chatpot",storage_adapter='chatterbot.storage.SQLStorageAdapter',database_uri = 'sqlite:///database.sqlite3',
|
8 |
-
logic_adapters=[ {
|
9 |
-
"import_path": "chatterbot.logic.BestMatch"
|
10 |
-
}
|
11 |
-
])
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
#file1 = open("dialogs.txt", "r")
|
17 |
-
#training_data = file1.read().splitlines()
|
18 |
-
|
19 |
-
|
20 |
-
#trainer = ListTrainer(chatbot)
|
21 |
-
#trainer.train(training_data)
|
22 |
-
|
23 |
-
trainer = ChatterBotCorpusTrainer(chatbot)
|
24 |
-
trainer.train("chatterbot.corpus.english","chatterbot.corpus.english.ai")
|
25 |
-
|
26 |
-
#print(training_data)
|
27 |
-
|
28 |
-
|
29 |
|
30 |
def greet(name):
|
31 |
-
text = chatbot.get_response(name)
|
32 |
|
33 |
-
if
|
34 |
result = wikipedia.summary(name, sentences =10)
|
35 |
return result
|
36 |
else:
|
37 |
-
return
|
38 |
|
39 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
40 |
iface.launch()
|
|
|
4 |
from chatterbot.trainers import ChatterBotCorpusTrainer
|
5 |
import wikipedia
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def greet(name):
|
9 |
+
#text = chatbot.get_response(name)
|
10 |
|
11 |
+
if "what" in name:
|
12 |
result = wikipedia.summary(name, sentences =10)
|
13 |
return result
|
14 |
else:
|
15 |
+
return "no found"
|
16 |
|
17 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
18 |
iface.launch()
|