Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def preprocess_text(text):
|
|
| 23 |
cleaned_text = text.strip()
|
| 24 |
|
| 25 |
# Split the cleaned_text by every newline character (\n)
|
| 26 |
-
chunks = cleaned_text.split("[
|
| 27 |
|
| 28 |
# Create an empty list to store cleaned chunks
|
| 29 |
cleaned_chunks = []
|
|
@@ -109,7 +109,7 @@ def respond(message, history):
|
|
| 109 |
|
| 110 |
str_recipes_chunk = "\n".join([str(chunk) for chunk in best_recipes_chunk])
|
| 111 |
|
| 112 |
-
messages = [{"role":"system","content": "You are a chatbot that is a nutrition expert and helps people with their nutritional goals. DON'T MAKE UP RECIPES. You can only output recipes from" + str_recipes_chunk + ". You CANNOT use the internet or make up recipes at any cost. ONLY use the text file provided. YOU HAVE to follow these rules. Don't output recipes that are not found in the text file provided."}]
|
| 113 |
|
| 114 |
if history:
|
| 115 |
messages.extend(history)
|
|
|
|
| 23 |
cleaned_text = text.strip()
|
| 24 |
|
| 25 |
# Split the cleaned_text by every newline character (\n)
|
| 26 |
+
chunks = cleaned_text.split("[END]")
|
| 27 |
|
| 28 |
# Create an empty list to store cleaned chunks
|
| 29 |
cleaned_chunks = []
|
|
|
|
| 109 |
|
| 110 |
str_recipes_chunk = "\n".join([str(chunk) for chunk in best_recipes_chunk])
|
| 111 |
|
| 112 |
+
messages = [{"role":"system","content": "You are a chatbot that is a nutrition expert and helps people with their nutritional goals. DON'T MAKE UP RECIPES. You can only output recipes from this context: " + str_recipes_chunk + ". You CANNOT use the internet or make up recipes at any cost. ONLY use the text file provided. YOU HAVE to follow these rules. Don't output recipes that are not found in the text file provided."}]
|
| 113 |
|
| 114 |
if history:
|
| 115 |
messages.extend(history)
|