Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,8 @@ load_dotenv()
|
|
11 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY")
|
12 |
co = cohere.Client(COHERE_API_KEY)
|
13 |
|
|
|
|
|
14 |
custom_css = """
|
15 |
.gradio-container {
|
16 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
@@ -431,7 +433,7 @@ def chat_with_diet_bot(message, history, session_id=None):
|
|
431 |
|
432 |
Generate a complete meal plan with:
|
433 |
1. Diet Overview - Brief summary of the diet approach
|
434 |
-
2. Weekly Meal Plan - Day-by-day plan with breakfast, lunch, dinner, and snacks
|
435 |
3. General Recommendations - Additional advice and nutrition tips
|
436 |
|
437 |
Format in Markdown with clear headers and bullet points.
|
@@ -448,6 +450,7 @@ def chat_with_diet_bot(message, history, session_id=None):
|
|
448 |
formatted_response = format_markdown(cohere_response)
|
449 |
response = formatted_response + "\n\nI hope this meal plan helps you achieve your goals! Feel free to ask if you have any nutrition questions."
|
450 |
state.current_step = "diet_questions"
|
|
|
451 |
|
452 |
except Exception:
|
453 |
response = "I'm sorry, I couldn't generate a diet plan at the moment. Please try again later."
|
@@ -477,6 +480,7 @@ def chat_with_diet_bot(message, history, session_id=None):
|
|
477 |
prompt = f"""
|
478 |
Answer this nutrition question clearly and accurately:
|
479 |
Question: {message}
|
|
|
480 |
Provide helpful, evidence-based advice with practical tips.
|
481 |
"""
|
482 |
|
|
|
11 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY")
|
12 |
co = cohere.Client(COHERE_API_KEY)
|
13 |
|
14 |
+
GIVEN_DIET = ""
|
15 |
+
|
16 |
custom_css = """
|
17 |
.gradio-container {
|
18 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
|
433 |
|
434 |
Generate a complete meal plan with:
|
435 |
1. Diet Overview - Brief summary of the diet approach
|
436 |
+
2. Weekly Meal Plan - Day-by-day plan with breakfast, lunch, dinner, and snacks. Add calories and macros for each day!
|
437 |
3. General Recommendations - Additional advice and nutrition tips
|
438 |
|
439 |
Format in Markdown with clear headers and bullet points.
|
|
|
450 |
formatted_response = format_markdown(cohere_response)
|
451 |
response = formatted_response + "\n\nI hope this meal plan helps you achieve your goals! Feel free to ask if you have any nutrition questions."
|
452 |
state.current_step = "diet_questions"
|
453 |
+
GIVEN_DIET = response
|
454 |
|
455 |
except Exception:
|
456 |
response = "I'm sorry, I couldn't generate a diet plan at the moment. Please try again later."
|
|
|
480 |
prompt = f"""
|
481 |
Answer this nutrition question clearly and accurately:
|
482 |
Question: {message}
|
483 |
+
Previous given diet: {GIVEN_DIET}
|
484 |
Provide helpful, evidence-based advice with practical tips.
|
485 |
"""
|
486 |
|