tywei08 commited on
Commit
9bfcf1d
·
verified ·
1 Parent(s): b77e7f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -22
app.py CHANGED
@@ -31,27 +31,6 @@ def create_assistant_json(uploaded_file, assistant_name, assistant_message):
31
  def play_music():
32
  music_path = "RPReplay_Final1712757356.mp3"
33
  return music_path, gr.update(visible=True)
34
-
35
- # def generate_cocktail(mood, sweetness, sour, savory, bitter, flavor_association, drinking_experience, soberness_level, allergies, additional_requests):
36
- # client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
37
- # instruction = "Please provide a cocktail recipe given the mood and preference of the user.\n\n"
38
- # 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"
39
- # 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]"
40
- # prompt = instruction + user_prompt + output_format
41
-
42
- # messages=[
43
- # {"role": "system", "content": "You are a helpful bartender assistant."},
44
- # {"role": "user", "content": prompt}
45
- # ]
46
- # try:
47
- # response = client.chat.completions.create(
48
- # model="gpt-4-0125-preview",
49
- # messages=messages,
50
- # max_tokens=1024)
51
- # name, quote, ingredients, instruction, notes = extract_info(response.choices[0].message.content)
52
- # return format_cocktail_output(name, quote, ingredients, instruction, notes), "Play background music"
53
- # except Exception as e:
54
- # return f'<p style="color: white; font-size: 20px;">{str(e)}</p>'
55
 
56
  def generate_cocktail(mood, sweetness, sour, savory, bitter, flavor_association, drinking_experience, soberness_level, allergies, additional_requests):
57
  client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
@@ -161,7 +140,7 @@ with gr.Blocks(css='''
161
  with gr.Row():
162
  gr.HTML('''
163
  <div style="text-align: center;">
164
- <img src="https://drive.google.com/file/d/1oUItrdwJbc2x8HVuVztOSV4dDCJqZWZc/view?pli=1" alt="MoodShaker Cocktail Generator">
165
  </div>
166
  ''')
167
  # gr.HTML('''
 
31
  def play_music():
32
  music_path = "RPReplay_Final1712757356.mp3"
33
  return music_path, gr.update(visible=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  def generate_cocktail(mood, sweetness, sour, savory, bitter, flavor_association, drinking_experience, soberness_level, allergies, additional_requests):
36
  client = openai.OpenAI(api_key=os.environ["API_TOKEN"])
 
140
  with gr.Row():
141
  gr.HTML('''
142
  <div style="text-align: center;">
143
+ <img src="https://drive.google.com/uc?id=1oUItrdwJbc2x8HVuVztOSV4dDCJqZWZc" alt="MoodShaker Cocktail Generator" class="centered-image">
144
  </div>
145
  ''')
146
  # gr.HTML('''