Spaces:
Sleeping
Sleeping
fix the cache example issue
Browse files- app.py +2 -1
- generate_results.py +20 -1
app.py
CHANGED
|
@@ -57,7 +57,7 @@ example_list = [
|
|
| 57 |
demo = gr.Interface(
|
| 58 |
fn=get_response, # Function to call
|
| 59 |
inputs="text", # Input type
|
| 60 |
-
outputs=gr.
|
| 61 |
title="WhatToCookToday",
|
| 62 |
description="""Welcome to WhatToCookToday! 🍳
|
| 63 |
Struggling to decide what to cook with the ingredients you already have?
|
|
@@ -81,6 +81,7 @@ Example prompts you can try:
|
|
| 81 |
""",
|
| 82 |
article=article,
|
| 83 |
examples=example_list,
|
|
|
|
| 84 |
live=False
|
| 85 |
)
|
| 86 |
|
|
|
|
| 57 |
demo = gr.Interface(
|
| 58 |
fn=get_response, # Function to call
|
| 59 |
inputs="text", # Input type
|
| 60 |
+
outputs=gr.Markdown(label="Suggested Recipes"),
|
| 61 |
title="WhatToCookToday",
|
| 62 |
description="""Welcome to WhatToCookToday! 🍳
|
| 63 |
Struggling to decide what to cook with the ingredients you already have?
|
|
|
|
| 81 |
""",
|
| 82 |
article=article,
|
| 83 |
examples=example_list,
|
| 84 |
+
cache_examples=False,
|
| 85 |
live=False
|
| 86 |
)
|
| 87 |
|
generate_results.py
CHANGED
|
@@ -7,7 +7,7 @@ client = OpenAI(api_key=OPENAI_API_KEY)
|
|
| 7 |
|
| 8 |
def format_recipes(query, raw_context):
|
| 9 |
prompt = f"""
|
| 10 |
-
You are a helpful cooking assistant.
|
| 11 |
The user asked: {query}
|
| 12 |
|
| 13 |
Here are some relevant recipes from the database:
|
|
@@ -17,6 +17,25 @@ def format_recipes(query, raw_context):
|
|
| 17 |
1. Summarize their ingredients clearly.
|
| 18 |
2. Rewrite the steps in a beginner-friendly, easy-to-follow way.
|
| 19 |
3. Keep the tone warm and encouraging, like you're guiding a new cook.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
"""
|
| 21 |
|
| 22 |
try:
|
|
|
|
| 7 |
|
| 8 |
def format_recipes(query, raw_context):
|
| 9 |
prompt = f"""
|
| 10 |
+
You are a helpful cooking assistant that responds in markdown format.
|
| 11 |
The user asked: {query}
|
| 12 |
|
| 13 |
Here are some relevant recipes from the database:
|
|
|
|
| 17 |
1. Summarize their ingredients clearly.
|
| 18 |
2. Rewrite the steps in a beginner-friendly, easy-to-follow way.
|
| 19 |
3. Keep the tone warm and encouraging, like you're guiding a new cook.
|
| 20 |
+
4. Format your response in proper Markdown with:
|
| 21 |
+
- Use ## for recipe titles
|
| 22 |
+
- Use **bold** for ingredient lists and important notes
|
| 23 |
+
- Use numbered lists (1. 2. 3.) for cooking steps
|
| 24 |
+
- Use - for bullet points when listing ingredients
|
| 25 |
+
- Use > for helpful tips or notes
|
| 26 |
+
|
| 27 |
+
Example format:
|
| 28 |
+
## Recipe Name
|
| 29 |
+
|
| 30 |
+
**Ingredients:**
|
| 31 |
+
- ingredient 1
|
| 32 |
+
- ingredient 2
|
| 33 |
+
|
| 34 |
+
**Instructions:**
|
| 35 |
+
1. Step one
|
| 36 |
+
2. Step two
|
| 37 |
+
|
| 38 |
+
> **Tip:** Helpful cooking tip here
|
| 39 |
"""
|
| 40 |
|
| 41 |
try:
|