Update app.py
Browse files
app.py
CHANGED
|
@@ -3,12 +3,13 @@ import gradio as gr
|
|
| 3 |
def chat_fn(message, history):
|
| 4 |
if history is None:
|
| 5 |
history = []
|
| 6 |
-
history.append(
|
|
|
|
| 7 |
return history
|
| 8 |
|
| 9 |
with gr.Blocks() as demo:
|
| 10 |
gr.Markdown("## Maind.ai 🤖")
|
| 11 |
-
chatbot = gr.Chatbot()
|
| 12 |
msg = gr.Textbox(placeholder="Sor...")
|
| 13 |
msg.submit(chat_fn, [msg, chatbot], chatbot)
|
| 14 |
|
|
|
|
| 3 |
def chat_fn(message, history):
|
| 4 |
if history is None:
|
| 5 |
history = []
|
| 6 |
+
history.append({"role": "user", "content": message})
|
| 7 |
+
history.append({"role": "assistant", "content": "AI: " + message})
|
| 8 |
return history
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
gr.Markdown("## Maind.ai 🤖")
|
| 12 |
+
chatbot = gr.Chatbot(value=[])
|
| 13 |
msg = gr.Textbox(placeholder="Sor...")
|
| 14 |
msg.submit(chat_fn, [msg, chatbot], chatbot)
|
| 15 |
|