Samilincoln
commited on
Commit
·
19d5716
1
Parent(s):
7f1bee4
reverted
Browse files
app.py
CHANGED
|
@@ -41,21 +41,19 @@ Instructions:
|
|
| 41 |
3. Maintain context across multiple messages.
|
| 42 |
"""
|
| 43 |
|
| 44 |
-
|
| 45 |
-
def recipe_chatbot(messages: str, history
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
history.append(messages)
|
| 51 |
-
|
| 52 |
return response.text
|
| 53 |
|
| 54 |
bot = gr.ChatInterface(
|
| 55 |
fn=recipe_chatbot,
|
| 56 |
-
type="messages"
|
| 57 |
-
title="Kitcher - The recipe Assistant",
|
| 58 |
-
description="Ask me about Nigerian dishes and I'll provide recipes or similar dish suggestions!",
|
| 59 |
)
|
| 60 |
|
| 61 |
-
bot.launch()
|
|
|
|
| 41 |
3. Maintain context across multiple messages.
|
| 42 |
"""
|
| 43 |
|
| 44 |
+
history = []
|
| 45 |
+
def recipe_chatbot(messages: str, history: list[str]):
|
| 46 |
+
ask = {
|
| 47 |
+
"current message" : messages,
|
| 48 |
+
"previous message": history[::-1]
|
| 49 |
+
}
|
| 50 |
history.append(messages)
|
| 51 |
+
response = model.generate_content([few_shot_prompt,ask], request_options=retry_policy)
|
| 52 |
return response.text
|
| 53 |
|
| 54 |
bot = gr.ChatInterface(
|
| 55 |
fn=recipe_chatbot,
|
| 56 |
+
type="messages"
|
|
|
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
+
bot.launch()
|