tywei08 commited on
Commit
011a997
·
verified ·
1 Parent(s): 950bde0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -16,7 +16,7 @@ def generate_cocktail(mood, sweetness, sour, savory, bitter, flavor_association,
16
  """Generates a cocktail recipe using OpenAI's GPT-4 based on user input."""
17
  client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
18
  instruction = "Please provide a cocktail recipe given the mood and preference of the user.\n\n"
19
- 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"
20
  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:[ingredient 1]\n[ingredient 2]\n...\nInstruction:1. [step 1]\n2. [step 2]\n...\nNotes:[notes]"
21
  prompt = instruction + user_prompt + output_format
22
 
@@ -82,7 +82,7 @@ with gr.Blocks(css=css_styles) as demo:
82
 
83
  with gr.Row():
84
  mood = gr.Textbox(label="How are you feeling today?", elem_classes=["custom-input"])
85
- flavor_association = gr.CheckboxGroup(label="Flavor Association", choices=["Fruity", "Herbal", "Spicy", "Floral", "Nutty", "Woody", "Earthy"], elem_classes=["custom-checkbox-group1"])
86
  drinking_experience = gr.CheckboxGroup(label="Drinking Experience", choices=["Refreshing", "Warming", "Comforting", "Energizing", "Relaxing"], elem_classes=["custom-checkbox-group2"])
87
 
88
  with gr.Row():
@@ -102,7 +102,7 @@ with gr.Blocks(css=css_styles) as demo:
102
 
103
  output_recipe = gr.HTML(label="Your Cocktail Recipe")
104
 
105
- play_button = gr.Button("Play Background Music", visible=False) # Initially not visible
106
  background_music = gr.Audio(label="Background Music", autoplay=True, visible=False) # Initially not visible
107
 
108
  def on_generate_click(*args):
 
16
  """Generates a cocktail recipe using OpenAI's GPT-4 based on user input."""
17
  client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
18
  instruction = "Please provide a cocktail recipe given the mood and preference of the user.\n\n"
19
+ user_prompt = f"Mood: {mood}\nTaste: Sweetness {sweetness}/10, Sour {sour}/10, Savory {savory}/10, Bitter {bitter}/10\nFlavor: {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"
20
  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:[ingredient 1]\n[ingredient 2]\n...\nInstruction:1. [step 1]\n2. [step 2]\n...\nNotes:[notes]"
21
  prompt = instruction + user_prompt + output_format
22
 
 
82
 
83
  with gr.Row():
84
  mood = gr.Textbox(label="How are you feeling today?", elem_classes=["custom-input"])
85
+ flavor_association = gr.CheckboxGroup(label="Flavor", choices=["Fruity", "Herbal", "Spicy", "Floral", "Nutty", "Woody", "Earthy"], elem_classes=["custom-checkbox-group1"])
86
  drinking_experience = gr.CheckboxGroup(label="Drinking Experience", choices=["Refreshing", "Warming", "Comforting", "Energizing", "Relaxing"], elem_classes=["custom-checkbox-group2"])
87
 
88
  with gr.Row():
 
102
 
103
  output_recipe = gr.HTML(label="Your Cocktail Recipe")
104
 
105
+ play_button = gr.Button("Play Background Music", visible=False, elem_classes=["generate-button"]) # Initially not visible
106
  background_music = gr.Audio(label="Background Music", autoplay=True, visible=False) # Initially not visible
107
 
108
  def on_generate_click(*args):