ibrahim yıldız commited on
Commit
7c19a44
·
verified ·
1 Parent(s): 30ee26c

Upload 3 files

Browse files
Files changed (3) hide show
  1. logo.png +0 -0
  2. mic.py +99 -0
  3. minerva.png +0 -0
logo.png ADDED
mic.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import google.generativeai as genai
3
+
4
+ # Configure the generative model
5
+ genai.configure(api_key='AIzaSyDIMoNuz4RgwLKaOCCbdQA09N7RFmCfyTk')
6
+
7
+ # Set page configuration
8
+ st.set_page_config(
9
+ page_title="Minerva Interactive Cookbook",
10
+ page_icon="/logo.png",
11
+ layout="wide",
12
+ )
13
+
14
+ # Logo image
15
+ st.image("logo.png", width=135)
16
+
17
+ # title
18
+ st.title('Minerva Interactive Cookbook')
19
+ st.write("Welcome to MIC! Use the dropdown menus to generate custom recipes. :cooking:")
20
+
21
+
22
+ # Define the list of dropdown options for each category
23
+ rotation_city = ["San Fransisco", "Tokyo", "Seoul", "Taipei", "Hyderabad", "Buenos Aires", "Berlin"]
24
+ course_options = ["Breakfast", "Appetizer", "Main Course", "Soup", "Salad", "Dessert"]
25
+ portion_options = ["1 person", "2 people", "3 people", "4 people", "5 people", "10 people"]
26
+ diet_options = ["No Restrictions", "Gluten-Free", "Halal", "Kosher", "Pescatarian", "Vegetarian", "Vegan"]
27
+ cooking_difficulty = ["Super Easy", "Easy", "Medium", "Hard"]
28
+ spice_options = ["No Spice", "Mild", "Medium", "Spicy"]
29
+ calorie_level = ["Low Calorie", "Medium Calorie", "High Calorie"]
30
+
31
+
32
+
33
+ # Create the dropdown boxes
34
+ city = st.selectbox("City:", [""] + rotation_city)
35
+ course = st.selectbox("Course:", [""] + course_options)
36
+ portion = st.selectbox("Portion:", [""] + portion_options)
37
+ diet = st.selectbox("Diet (optional):", [""] + diet_options)
38
+ difficulty = st.selectbox("Difficulty (optional):", [""] + cooking_difficulty)
39
+ spice = st.selectbox("Spice (optional):", [""] + spice_options)
40
+ calorie = st.selectbox("calorie (optional):", [""] + calorie_level)
41
+ # Text input for additional requests
42
+ extra_requests = st.text_input("Optional Requests (e.g., no onions, high fiber):")
43
+
44
+
45
+
46
+ # error handling
47
+ if "" in [city, course, portion]:
48
+ st.error("Please select a value for following fields: City, Course, and Portion.")
49
+ st.stop()
50
+
51
+
52
+ # define model
53
+ model = genai.GenerativeModel('gemini-1.5-pro-latest')
54
+ chat = model.start_chat(history=[])
55
+
56
+
57
+ # Button to trigger recipe generation
58
+ if st.button('Find Recipes'):
59
+
60
+ # Use the generative model to get recipe information
61
+ prompt = f"Generate 3 recipes that are available in {city}, for {course} and for {portion}."
62
+ prompt += """The recipies dont necessarily have to belong to the cousine of the stated city,
63
+ the ingredients just have to be easy to find there. Just give at least one local dish. Change currencies by city.
64
+ Include ingredient quantities and their prices. The output should be in this example format:
65
+ Recipes
66
+ ---------
67
+ **Vegetable Yakisoba** - A flavorful lentil and vegetable soup with a hint of spice and sweetness.
68
+ Ingredients:
69
+ - 250g Yakisoba Noodles: $2.50
70
+ - 1 small head Cabbage, shredded: $1.20
71
+ - 2 large Carrots, julienned: $0.80
72
+ - 1 Red Bell Pepper, sliced: $0.75
73
+ - 1 Yellow Bell Pepper, sliced: $0.75
74
+ - 1 large Onion, sliced: $0.70
75
+ - 200g Mushrooms, sliced: $2.30
76
+ - 1/2 cup Soy Sauce: $1.80
77
+ - 2 tbsp Rice Vinegar: $1.50
78
+ **Total Estimated Price:** $12.30
79
+ Instructions:
80
+ 1. Pressure cook the soaked moong dal until soft.
81
+ 2. In a pan, heat ghee/oil and add cumin seeds. Once they splutter.
82
+ ---------
83
+ .... and so on"""
84
+ if diet:
85
+ prompt += f"It should be suitable for a {diet} diet."
86
+ if difficulty:
87
+ prompt += f"It should have a cooking difficulty of {difficulty}."
88
+ if spice:
89
+ prompt += f"It should have a spice level of {spice}."
90
+ if calorie:
91
+ prompt += f"It should have a calorie level of {calorie}."
92
+ if extra_requests:
93
+ prompt += f"Additionally, {extra_requests}"
94
+
95
+ response = chat.send_message(prompt)
96
+ st.write(response.text)
97
+
98
+ # background image
99
+ st.image("minerva.png")
minerva.png ADDED