Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,17 @@ description = "This is a chatbot application based on the llama2 70B model. Simp
|
|
| 85 |
examples = [["what is your contact number?"], ["where you are currently working?"]]
|
| 86 |
|
| 87 |
|
| 88 |
-
def greet(query1, history):
|
| 89 |
-
return chain.run(input_documents=documents, question="answer as if person responding. do not ask question back. \n Question: "+query1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
gr.ChatInterface(greet,title = "Chat with my Bot", description=description,examples=examples).launch(debug = True)
|
|
|
|
| 85 |
examples = [["what is your contact number?"], ["where you are currently working?"]]
|
| 86 |
|
| 87 |
|
| 88 |
+
#def greet(query1, history):
|
| 89 |
+
# return chain.run(input_documents=documents, question="answer as if person responding. do not ask question back. \n Question: "+query1)
|
| 90 |
+
|
| 91 |
+
list_greet = ["hi","hey","yo"]
|
| 92 |
+
def greet(query1):
|
| 93 |
+
try:
|
| 94 |
+
if query1.lower() in list_greet:
|
| 95 |
+
return "Hello. How can I assist you today?"
|
| 96 |
+
else:
|
| 97 |
+
return chain.run(input_documents=documents, question="answer as if person responding. do not ask question back. \n question: "+query1.lower())
|
| 98 |
+
except:
|
| 99 |
+
return "API error"
|
| 100 |
|
| 101 |
gr.ChatInterface(greet,title = "Chat with my Bot", description=description,examples=examples).launch(debug = True)
|