Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import pyjokes
|
|
6 |
|
7 |
|
8 |
|
|
|
9 |
def joke():
|
10 |
# importing installed library
|
11 |
|
@@ -35,7 +36,10 @@ def wiki(name):
|
|
35 |
|
36 |
def google(name):
|
37 |
result = {"",""}
|
38 |
-
text =
|
|
|
|
|
|
|
39 |
url = "https://www.google.com/search?q="+name
|
40 |
r = requests.get(url)
|
41 |
|
@@ -66,7 +70,7 @@ def google(name):
|
|
66 |
|
67 |
def greet(name1):
|
68 |
name = name1.lower()
|
69 |
-
|
70 |
if "who are you" in name or "what is you" in name or "your name" in name or"who r u" in name:
|
71 |
|
72 |
return "Im Ai Based Chatbot Created by ssebowa.org"
|
@@ -98,4 +102,21 @@ def greet(name1):
|
|
98 |
|
99 |
|
100 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
101 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
|
9 |
+
|
10 |
def joke():
|
11 |
# importing installed library
|
12 |
|
|
|
36 |
|
37 |
def google(name):
|
38 |
result = {"",""}
|
39 |
+
text =""
|
40 |
+
if "how to learn" in word or "steps for learning" in word or "step for learning" in word or "steps for" in word or "step for" in word:
|
41 |
+
text = result = aitext(word)+"\n\n"
|
42 |
+
|
43 |
url = "https://www.google.com/search?q="+name
|
44 |
r = requests.get(url)
|
45 |
|
|
|
70 |
|
71 |
def greet(name1):
|
72 |
name = name1.lower()
|
73 |
+
|
74 |
if "who are you" in name or "what is you" in name or "your name" in name or"who r u" in name:
|
75 |
|
76 |
return "Im Ai Based Chatbot Created by ssebowa.org"
|
|
|
102 |
|
103 |
|
104 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
105 |
+
iface.launch()
|
106 |
+
|
107 |
+
|
108 |
+
import openai
|
109 |
+
openai.api_key = "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"
|
110 |
+
def aitext(word):
|
111 |
+
response = openai.Completion.create(
|
112 |
+
model="text-davinci-003",
|
113 |
+
prompt=word,
|
114 |
+
temperature=0.9,
|
115 |
+
max_tokens=400,
|
116 |
+
top_p=1,
|
117 |
+
frequency_penalty=0,
|
118 |
+
presence_penalty=0.6,
|
119 |
+
stop=[" Human:", " AI:"]
|
120 |
+
)
|
121 |
+
|
122 |
+
return response.choices[0].text
|