Spaces:
Sleeping
Sleeping
Ramon
commited on
Commit
·
7327b7d
1
Parent(s):
837588c
chabot
Browse files
app.py
CHANGED
|
@@ -12,12 +12,21 @@ def chat_fn(message, history):
|
|
| 12 |
# Extract the generated text from the response
|
| 13 |
reply = response[0]['generated_text']
|
| 14 |
|
| 15 |
-
# Update history
|
| 16 |
-
history
|
|
|
|
| 17 |
return history
|
| 18 |
|
| 19 |
with gr.Blocks() as dennis_denuto:
|
| 20 |
-
chatbot = gr.Chatbot(
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
dennis_denuto.launch()
|
|
|
|
| 12 |
# Extract the generated text from the response
|
| 13 |
reply = response[0]['generated_text']
|
| 14 |
|
| 15 |
+
# Update history with the new message format
|
| 16 |
+
history.append({"role": "user", "content": message})
|
| 17 |
+
history.append({"role": "assistant", "content": reply})
|
| 18 |
return history
|
| 19 |
|
| 20 |
with gr.Blocks() as dennis_denuto:
|
| 21 |
+
chatbot = gr.Chatbot(
|
| 22 |
+
placeholder="<strong>It's the vibe.</strong><br>Ask anything about criminal law and procedure in Australia.",
|
| 23 |
+
type="messages"
|
| 24 |
+
)
|
| 25 |
+
gr.ChatInterface(
|
| 26 |
+
fn=chat_fn,
|
| 27 |
+
type="messages",
|
| 28 |
+
chatbot=chatbot,
|
| 29 |
+
save_history=True
|
| 30 |
+
)
|
| 31 |
|
| 32 |
dennis_denuto.launch()
|