Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def generate_cocktail(mood, sweetness, sour, savory, bitter, flavor_association,
|
|
32 |
client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
|
33 |
instruction = "Please provide a cocktail recipe given the mood and preference of the user.\n\n"
|
34 |
user_prompt = f"Mood: {mood}\nTaste: Sweetness {sweetness}/10, Sour {sour}/10, Savory {savory}/10, Bitter {bitter}/10\nFlavor Association: {flavor_association}\nDrinking Experience: {drinking_experience}\nLevel of Soberness: {soberness_level}\nAllergies: {allergies}\nAdditional Requests: {additional_requests}\n\nMake sure to avoid all allergic ingredients.\n\n"
|
35 |
-
output_format = "Please strictly follow this output format:\n\nCocktail Name:[name]\
|
36 |
prompt = instruction + user_prompt + output_format
|
37 |
|
38 |
messages=[
|
@@ -66,12 +66,15 @@ def format_cocktail_output(name, quote, ingredients, instruction, notes):
|
|
66 |
# Construct the HTML output
|
67 |
html_output = f'''
|
68 |
<div style="text-align: center; font-family: 'monospace'; color: #FFFFFF;">
|
69 |
-
<h1 style="font-size: 40px;">{name}</h1>
|
70 |
-
<p style="font-size: 30px; margin-top: -10px; font-style: italic;">{quote}</p>
|
71 |
-
<p style="font-size: 18px;">
|
72 |
-
<strong>Ingredients:</strong
|
73 |
-
|
74 |
-
<strong>
|
|
|
|
|
|
|
75 |
</p>
|
76 |
</div>
|
77 |
'''
|
|
|
32 |
client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
|
33 |
instruction = "Please provide a cocktail recipe given the mood and preference of the user.\n\n"
|
34 |
user_prompt = f"Mood: {mood}\nTaste: Sweetness {sweetness}/10, Sour {sour}/10, Savory {savory}/10, Bitter {bitter}/10\nFlavor Association: {flavor_association}\nDrinking Experience: {drinking_experience}\nLevel of Soberness: {soberness_level}\nAllergies: {allergies}\nAdditional Requests: {additional_requests}\n\nMake sure to avoid all allergic ingredients.\n\n"
|
35 |
+
output_format = "Please strictly follow this output format:\n\nCocktail Name:[name]\nQuote:[one sentence quote related to the cocktail and the mood description]\nIngredients:\n[ingredient 1]\n[ingredient 2]\n...\nInstruction:\n1. [step 1]\n2. [step 2]\n...\nNotes:[notes]"
|
36 |
prompt = instruction + user_prompt + output_format
|
37 |
|
38 |
messages=[
|
|
|
66 |
# Construct the HTML output
|
67 |
html_output = f'''
|
68 |
<div style="text-align: center; font-family: 'monospace'; color: #FFFFFF;">
|
69 |
+
<h1 style="font-size: 40px; color: white;">{name}</h1>
|
70 |
+
<p style="font-size: 30px; margin-top: -10px; font-style: italic; color: white;">{quote}</p>
|
71 |
+
<p style="font-size: 18px; color: white;">
|
72 |
+
<strong>Ingredients:</strong><br>
|
73 |
+
{ingredients}<br>
|
74 |
+
<strong>Instruction:</strong><br>
|
75 |
+
{instruction}<br>
|
76 |
+
<strong>Notes:</strong><br>
|
77 |
+
{notes}<br>
|
78 |
</p>
|
79 |
</div>
|
80 |
'''
|