' in str(info):
if '›' not in str(info.text) :
result.add(info.text)
n=0
for i in result:
if n!=0:
i = i.split("·",1)
try:
i = i[1]
except:
i = i[0]
i=i.split("Duration")
i = i[0]
text = text +str(n)+"\t"+i+"\n\n"
n=n+1
if result_count == 1:
temp = ""
for r in text.split("\n\n"):
temp = temp+r.split("...")[0]
f_result = sumy({"inputs":temp,"parameters": {"do_sample": False,"max_length":300}})
return f_result[0]['summary_text']
else:
n=1
for r in text.split("\n\n")[2:-2]:
if len(r)>10:
if "..." in r:
r = r.split("...")
w = query(r[0].replace("\xa0",""))
f_result = f_result + str(n)+"\t"+(w[0]['summary_text'])+"\n\n"+r"\\"
else:
#print(r[:-1])
w = query(r[:-1])
f_result = f_result + str(n)+"\t"+(w[0]['summary_text'])+"\n\n"+r"\\"
n=n+1
return f_result
def greet(name1):
name = name1.lower()
if "who are you" in name or "what is you" in name or "your name" in name or"who r u" in name:
return "Im Ai Based Chatbot Created by ssebowa.org"
if "who developed you" in name or "what is you" in name or "who mad you" in name or "who made you" in name:
return "ssebowa.org"
if "tell me a joke" in name or "the joke" in name:
return joke()
if "love you" in name or "i love" in name:
return "me too"
if "marry me" in name or "marry" in name:
return "im not intrested"
if "your age" in name or "what is your age" in name:
return "Im not a human so i don't have age"
if "thank u" in name or "thanks" in name or "thank you" in name:
return "ok welcome ....!"
if "how to learn" in name or "steps for learning" in name or "step for learning" in name or "steps for" in name or "step for" in name:
try:
return {"result":google(name)+"\n\n"+code(name)}
except:
return {"result":google(name)}
else:
return google(name)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()