Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ messages = [
|
|
| 31 |
|
| 32 |
def handle_message(message: str, mode: str):
|
| 33 |
|
| 34 |
-
# Check if
|
| 35 |
if not message.strip():
|
| 36 |
return "Enter a valid message."
|
| 37 |
if mode == "Chat":
|
|
@@ -59,7 +59,7 @@ def web_search(message: str):
|
|
| 59 |
else:
|
| 60 |
source_knowledge = ""
|
| 61 |
augmented_prompt = f"""
|
| 62 |
-
If the answer to the next query is not contained in the Web Search say 'No Answer Available' and give guidance relevant to the query.
|
| 63 |
|
| 64 |
Query: {message}
|
| 65 |
|
|
@@ -76,7 +76,7 @@ def web_search(message: str):
|
|
| 76 |
|
| 77 |
demo = gr.Interface(
|
| 78 |
fn=handle_message,
|
| 79 |
-
inputs=["text", gr.Radio(["Chat", "Web-Search"], label="
|
| 80 |
outputs="text",
|
| 81 |
title="IT Assistant")
|
| 82 |
demo.launch()
|
|
|
|
| 31 |
|
| 32 |
def handle_message(message: str, mode: str):
|
| 33 |
|
| 34 |
+
# Check if message is empty
|
| 35 |
if not message.strip():
|
| 36 |
return "Enter a valid message."
|
| 37 |
if mode == "Chat":
|
|
|
|
| 59 |
else:
|
| 60 |
source_knowledge = ""
|
| 61 |
augmented_prompt = f"""
|
| 62 |
+
If the answer to the next query is not contained in the Web Search say 'No Answer Is Available' and only give guidance relevant to the query.
|
| 63 |
|
| 64 |
Query: {message}
|
| 65 |
|
|
|
|
| 76 |
|
| 77 |
demo = gr.Interface(
|
| 78 |
fn=handle_message,
|
| 79 |
+
inputs=["text", gr.Radio(["Chat", "Web-Search"], label="mode", info="Choose a mode and enter your message, then click submit to interact.")],
|
| 80 |
outputs="text",
|
| 81 |
title="IT Assistant")
|
| 82 |
demo.launch()
|