Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from chatterbot import ChatBot
|
| 3 |
from chatterbot.trainers import ListTrainer
|
| 4 |
from chatterbot.trainers import ChatterBotCorpusTrainer
|
| 5 |
-
|
| 6 |
|
| 7 |
chatbot = ChatBot("Chatpot",storage_adapter='chatterbot.storage.SQLStorageAdapter',database_uri = 'sqlite:///database.sqlite3',
|
| 8 |
logic_adapters=[ {
|
|
@@ -29,6 +29,10 @@ trainer.train("chatterbot.corpus.english","chatterbot.corpus.english.ai")
|
|
| 29 |
|
| 30 |
def greet(name):
|
| 31 |
text = chatbot.get_response(name)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
return str(text)
|
| 33 |
|
| 34 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
|
| 2 |
from chatterbot import ChatBot
|
| 3 |
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=[ {
|
|
|
|
| 29 |
|
| 30 |
def greet(name):
|
| 31 |
text = chatbot.get_response(name)
|
| 32 |
+
|
| 33 |
+
if text == "wiki":
|
| 34 |
+
result = wikipedia.summary(name, sentences =10)
|
| 35 |
+
return result
|
| 36 |
return str(text)
|
| 37 |
|
| 38 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|