Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from chatterbot import ChatBot
|
| 3 |
-
from chatterbot.trainers import ListTrainer
|
| 4 |
-
from chatterbot.trainers import ChatterBotCorpusTrainer
|
| 5 |
import wikipedia
|
| 6 |
import requests
|
| 7 |
from bs4 import BeautifulSoup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def qq():
|
| 10 |
#text = chatbot.get_response(name)
|
|
@@ -19,6 +27,10 @@ def greet(name):
|
|
| 19 |
if "who are you" in name or "who r u" in name:
|
| 20 |
|
| 21 |
return "im ssebowa.org created Chatbot"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
url = "https://www.google.com/search?q="+name
|
| 23 |
r = requests.get(url)
|
| 24 |
|
|
@@ -31,8 +43,8 @@ def greet(name):
|
|
| 31 |
n=n+1
|
| 32 |
p=""
|
| 33 |
if n==9:
|
| 34 |
-
print("------",n)
|
| 35 |
-
result = info.getText()[
|
| 36 |
result = result.split(".")
|
| 37 |
for s in result[:10]:
|
| 38 |
p = p + s
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
import wikipedia
|
| 3 |
import requests
|
| 4 |
from bs4 import BeautifulSoup
|
| 5 |
+
import pyjokes
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def joke():
|
| 10 |
+
# importing installed library
|
| 11 |
+
|
| 12 |
+
My_joke = pyjokes.get_joke(language="en", category="neutral")
|
| 13 |
+
|
| 14 |
+
return My_joke
|
| 15 |
+
|
| 16 |
|
| 17 |
def qq():
|
| 18 |
#text = chatbot.get_response(name)
|
|
|
|
| 27 |
if "who are you" in name or "who r u" in name:
|
| 28 |
|
| 29 |
return "im ssebowa.org created Chatbot"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
if "tell me a joke" in name or "joke" in name:
|
| 33 |
+
return joke()
|
| 34 |
url = "https://www.google.com/search?q="+name
|
| 35 |
r = requests.get(url)
|
| 36 |
|
|
|
|
| 43 |
n=n+1
|
| 44 |
p=""
|
| 45 |
if n==9:
|
| 46 |
+
#print("------",n)
|
| 47 |
+
result = info.getText()[170:]
|
| 48 |
result = result.split(".")
|
| 49 |
for s in result[:10]:
|
| 50 |
p = p + s
|