Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,11 +49,7 @@ chain = create_retrieval_chain(retriever, doc_chain)
|
|
| 49 |
# Chatbot response function
|
| 50 |
def respond(
|
| 51 |
message,
|
| 52 |
-
history
|
| 53 |
-
system_message,
|
| 54 |
-
max_tokens,
|
| 55 |
-
temperature,
|
| 56 |
-
top_p,
|
| 57 |
):
|
| 58 |
# Check if message is a list and convert it to the first element as a string
|
| 59 |
if isinstance(message, list):
|
|
@@ -77,21 +73,12 @@ def respond(
|
|
| 77 |
# Return the updated history
|
| 78 |
return "", history
|
| 79 |
|
|
|
|
| 80 |
# Gradio Chat Interface
|
| 81 |
demo = gr.ChatInterface(
|
| 82 |
-
respond,
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 86 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 87 |
-
gr.Slider(
|
| 88 |
-
minimum=0.1,
|
| 89 |
-
maximum=1.0,
|
| 90 |
-
value=0.95,
|
| 91 |
-
step=0.05,
|
| 92 |
-
label="Top-p (nucleus sampling)",
|
| 93 |
-
),
|
| 94 |
-
],
|
| 95 |
)
|
| 96 |
|
| 97 |
if __name__ == "__main__":
|
|
|
|
| 49 |
# Chatbot response function
|
| 50 |
def respond(
|
| 51 |
message,
|
| 52 |
+
history
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
):
|
| 54 |
# Check if message is a list and convert it to the first element as a string
|
| 55 |
if isinstance(message, list):
|
|
|
|
| 73 |
# Return the updated history
|
| 74 |
return "", history
|
| 75 |
|
| 76 |
+
chatbot = gr.Chatbot(placeholder="<strong>Chatbot that answers questions on agile processes</strong><br>Ask Me Anything")
|
| 77 |
# Gradio Chat Interface
|
| 78 |
demo = gr.ChatInterface(
|
| 79 |
+
fn=respond,
|
| 80 |
+
type="messages",
|
| 81 |
+
chatbot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
if __name__ == "__main__":
|