♊️ GemiNews 🗞️
(dev)
🏡
📰 Articles
🏷️ Tags
🧠 Queries
📈 Graphs
☁️ Stats
💁🏻 Assistant
💬
🎙️
Demo 1: Embeddings + Recommendation
Demo 2: Bella RAGa
Demo 3: NewRetriever
Demo 4: Assistant function calling
Editing article
Title
Summary
Content
<blockquote>Recipe Mixer is an AI-powered web application that encourages culinary exploration through recipe remixing. Users can input a recipe or list ingredients they have on hand, and the application utilizes the Gemini Pro model to suggest alternative ingredients based on flavor profiles and user preferences, including dietary restrictions.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WztpIzEwXLtIAPHgrdAntA.gif" /></figure><h4>Why use Recipe Mixer?</h4><p>Recipe Mixer is a user-friendly web application that helps you find delicious recipes based on the ingredients you have on hand. Whether you’re a busy parent, a cooking enthusiast, or someone with dietary restrictions, Recipe Mixer makes meal planning easy and enjoyable.</p><p>All you need to do is input the ingredients you have in your kitchen and specify any dietary preferences you may have, such as vegetarian or gluten-free. Recipe Mixer then suggests personalized recipe options that match your input. It even offers alternative ingredient suggestions and can adapt recipes to different cultural cuisines, so you can explore new flavors and cooking styles.</p><p>With Recipe Mixer, you no longer have to worry about what to cook for dinner or how to use up leftover ingredients. It’s like having a personal chef at your fingertips, ready to inspire you with creative and delicious meal ideas.</p><h4>Features</h4><ul><li><strong>Ingredient Matching:</strong> Users can input a list of ingredients they have on hand, and the application suggests recipes based on those ingredients.</li><li><strong>Dietary Preferences:</strong> Users can specify dietary preferences such as vegetarian, vegan, or gluten-free, and the suggested recipes take these preferences into account.</li><li><strong>Alternative Ingredient Suggestions:</strong> The application suggests alternative ingredients based on flavor profiles and dietary preferences, allowing users to experiment with different ingredients.</li><li><strong>Cultural Adaptation:</strong> The suggested recipes can be adapted to different cultural cuisines, promoting culinary exploration and diversity.</li></ul><h4>Dependencies</h4><ul><li><strong>Gemini Pro LLM:</strong> Natural language processing model for text classification.</li><li><strong>Streamlit:</strong> Web application framework for building interactive web applications.</li><li><strong>Google Generative AI:</strong> Integrates advanced AI capabilities into the application.</li><li><strong>python-dotenv:</strong> python-dotenv is a Python library that allows you to read environment variables from .env files.</li><li><strong>langchain.llms:</strong> langchain.llms is a library used to interact with language models, particularly for text generation tasks.</li></ul><h4>How it works?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BcrtnKnVez7YEpYpSjp84g.gif" /></figure><h3>Building Recipe Mixer🧑🏻🍳</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCwRD0yFB7ylxDsl36BKUQ.gif" /></figure><h4>Requirements:</h4><ul><li>Python 3.10</li><li><a href="https://ai.google.dev/">Gemini Pro API key</a> (Note: Ensure you have the necessary credentials and permissions to access the Gemini Pro API)</li></ul><h4>Steps:</h4><ol><li>Clone the repository</li></ol><pre>git clone https://github.com/Gitesh08/recipe-mixer.git</pre><p>or create <strong>app.py</strong> file and paste below code.</p><pre>import streamlit as st<br>import google.generativeai as genai<br>from dotenv import load_dotenv<br>import os<br><br># Load environment variables from a .env file<br>load_dotenv()<br><br># Configure the generative AI model with the Google API key<br>genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))<br><br># Set up the model configuration for text generation<br>generation_config = {<br> "temperature": 0.4,<br> "top_p": 1,<br> "top_k": 32,<br> "max_output_tokens": 4096,<br>}<br><br> # Create a GenerativeModel instance with 'gemini-pro' as the model type<br>llm = genai.GenerativeModel(<br> model_name="gemini-pro",<br> generation_config=generation_config,<br> )<br> <br>def match_ingredients(user_ingredients, dietary_preferences=None):<br> """<br> Matches ingredients with recipes using Gemini Pro (if available).<br><br> Args:<br> user_ingredients (list): List of user-provided ingredients (lowercase and stripped).<br> dietary_preferences (str, optional): User's dietary preferences (e.g., vegetarian, vegan).<br><br> Returns:<br> tuple: A tuple containing the recipe name and instructions (if found), otherwise None.<br> """<br> <br> prompt_template = """Find a delicious recipe using these ingredients: {ingredients}. <br> {dietary_preferences_prompt}<br> I want the response in a single structured format."""<br><br> dietary_preferences_prompt = f"Considering dietary restrictions: {dietary_preferences}" if dietary_preferences else ""<br><br> prompt = prompt_template.format(ingredients=", ".join(user_ingredients), dietary_preferences_prompt=dietary_preferences_prompt)<br><br> response = llm.generate_content(prompt)<br><br> # Parse the response from Gemini Pro to extract the matching recipe name and instructions (implementation depends on API response format)<br> recipe = response.text<br> # ... (code to parse response and extract recipe information)<br> return recipe<br><br>st.set_page_config(page_title="Recipe Mixer")<br><br>st.title("Recipe Mixer" + ":sunglasses:")<br>st.markdown('<style>h1{color: orange; text-align: center; font-family:POPPINS}</style>', unsafe_allow_html=True)<br><br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br><br>user_ingred = st.text_input("Enter your ingredients (comma-separated):")<br><br># Add dietary preference dropdown<br>dietary_options = st.selectbox("Dietary Preferences (Optional):", [None, "Vegetarian", "Vegan", "Gluten-Free"])<br><br>submit_button = st.button("Suggest me recipe")<br>user_ingredients = user_ingred.split(", ")<br><br><br>if submit_button:<br> if user_ingred is not None:<br> # Preprocess user ingredients<br> user_ingredients_str = [ingredient.strip().lower() for ingredient in user_ingred.split(", ")]<br> <br> # Call match_ingredients once and assign results<br> recipe = match_ingredients(user_ingredients_str, dietary_preferences=dietary_options)<br><br> if recipe:<br> complete_recipe = f"\n{recipe}\n"<br> st.write(complete_recipe.replace('\\n', '\n'))<br> else:<br> st.write("No Recipe")<br> <br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br>st.text(" \n")<br><br>footer="""<style><br>a:link , a:visited{<br>color: yellow;<br>background-color: transparent;<br>text-decoration: underline;<br>}<br><br>a:hover, a:active {<br>color: red;<br>background-color: transparent;<br>text-decoration: underline;<br>}<br><br>.footer {<br>position: Bottom;<br>left: 0;<br>bottom: 0;<br>width: 100%;<br>background-color: transparent;<br>color: white;<br>text-align: center;<br>}<br></style><br><div class="footer"><br><p>Developed with ❤ by<a style='display: block; text-align: center;' href="https://github.com/Gitesh08" target="_blank">Gitesh Mahadik</a></p><br></div><br>"""<br>st.markdown(footer,unsafe_allow_html=True)</pre><p>Create file <strong>requirements.txt</strong> and paste below code.</p><pre>streamlit<br>google-generativeai<br>python-dotenv<br>langchain</pre><p>2. Create a Python virtual environment. Open a new terminal of your editor and paste below command.</p><pre>python -m virtualenv .</pre><p>3. Activate virtual environment. Paste below command in terminal.</p><pre>.\scripts\activate</pre><p>4. Install the required dependencies.</p><pre>pip install -r requirements.txt</pre><p>5. Generate Gemini Pro API Key:</p><p><a href="https://ai.google.dev/">Build with the Gemini API | Google AI for Developers</a></p><p>6. Create <strong>.env</strong> file and define your API Key.</p><pre>GOOGLE_API_KEY = "Replace with your API Key"</pre><p>7. Run the application.</p><pre>streamlit run app.py</pre><p>Access the application through your web browser using the provided local address.</p><p><strong>Great! You have successfully built Recipe Mixer using the Gemini Pro LLM model.</strong></p><p><strong>Please give a star to this repo!</strong></p><p><a href="https://github.com/Gitesh08/Recipe-Mixer">GitHub - Gitesh08/Recipe-Mixer</a></p><h4>Usage</h4><ul><li><strong>Input your ingredients:</strong> Enter a list of ingredients you have on hand, separated by commas.</li><li><strong>Specify dietary preferences (optional):</strong> Select your dietary preferences from the dropdown menu.</li><li>Click the <strong>“Suggest me recipe”</strong> button to receive recipe suggestions.</li><li>Explore alternative ingredient suggestions and recipe options.</li><li>Enjoy experimenting with different recipes and ingredients!</li></ul><p><strong>Contributions are welcome! If you have any suggestions, enhancements, or bug fixes, feel free to open an issue or submit a pull request.</strong></p><p>Thank you for reading! I hope you enjoyed this article. If you did, please consider subscribing to my Medium publication. You can also follow me on <a href="https://www.linkedin.com/in/gitesh-mahadik%E2%98%81%EF%B8%8F-7487961a0/">LinkedIn</a> for more updates.</p><p>If you have any questions or feedback, please feel free to leave a comment below. I would love to hear from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88fe60836e43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/recipe-mixer-88fe60836e43">Recipe Mixer🧑🏻🍳</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>
Author
Link
Published date
Image url
Feed url
Guid
Hidden blurb
--- !ruby/object:Feedjira::Parser::RSSEntry title: Recipe Mixer published: 2024-04-05 04:51:23.000000000 Z categories: - generative-ai - google-cloud-platform - llm - genai - geminipro entry_id: !ruby/object:Feedjira::Parser::GloballyUniqueIdentifier is_perma_link: 'false' guid: https://medium.com/p/88fe60836e43 carlessian_info: news_filer_version: 2 newspaper: Google Cloud - Medium macro_region: Blogs content: "<blockquote>Recipe Mixer is an AI-powered web application that encourages culinary exploration through recipe remixing. Users can input a recipe or list ingredients they have on hand, and the application utilizes the Gemini Pro model to suggest alternative ingredients based on flavor profiles and user preferences, including dietary restrictions.</blockquote><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*WztpIzEwXLtIAPHgrdAntA.gif\" /></figure><h4>Why use Recipe Mixer?</h4><p>Recipe Mixer is a user-friendly web application that helps you find delicious recipes based on the ingredients you have on hand. Whether you’re a busy parent, a cooking enthusiast, or someone with dietary restrictions, Recipe Mixer makes meal planning easy and enjoyable.</p><p>All you need to do is input the ingredients you have in your kitchen and specify any dietary preferences you may have, such as vegetarian or gluten-free. Recipe Mixer then suggests personalized recipe options that match your input. It even offers alternative ingredient suggestions and can adapt recipes to different cultural cuisines, so you can explore new flavors and cooking styles.</p><p>With Recipe Mixer, you no longer have to worry about what to cook for dinner or how to use up leftover ingredients. It’s like having a personal chef at your fingertips, ready to inspire you with creative and delicious meal ideas.</p><h4>Features</h4><ul><li><strong>Ingredient Matching:</strong> Users can input a list of ingredients they have on hand, and the application suggests recipes based on those ingredients.</li><li><strong>Dietary Preferences:</strong> Users can specify dietary preferences such as vegetarian, vegan, or gluten-free, and the suggested recipes take these preferences into account.</li><li><strong>Alternative Ingredient Suggestions:</strong> The application suggests alternative ingredients based on flavor profiles and dietary preferences, allowing users to experiment with different ingredients.</li><li><strong>Cultural Adaptation:</strong> The suggested recipes can be adapted to different cultural cuisines, promoting culinary exploration and diversity.</li></ul><h4>Dependencies</h4><ul><li><strong>Gemini Pro LLM:</strong> Natural language processing model for text classification.</li><li><strong>Streamlit:</strong> Web application framework for building interactive web applications.</li><li><strong>Google Generative AI:</strong> Integrates advanced AI capabilities into the application.</li><li><strong>python-dotenv:</strong> python-dotenv is a Python library that allows you to read environment variables from .env files.</li><li><strong>langchain.llms:</strong> langchain.llms is a library used to interact with language models, particularly for text generation tasks.</li></ul><h4>How it works?</h4><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*BcrtnKnVez7YEpYpSjp84g.gif\" /></figure><h3>Building Recipe Mixer\U0001F9D1\U0001F3FB\U0001F373</h3><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*DCwRD0yFB7ylxDsl36BKUQ.gif\" /></figure><h4>Requirements:</h4><ul><li>Python 3.10</li><li><a href=\"https://ai.google.dev/\">Gemini Pro API key</a> (Note: Ensure you have the necessary credentials and permissions to access the Gemini Pro API)</li></ul><h4>Steps:</h4><ol><li>Clone the repository</li></ol><pre>git clone https://github.com/Gitesh08/recipe-mixer.git</pre><p>or create <strong>app.py</strong> file and paste below code.</p><pre>import streamlit as st<br>import google.generativeai as genai<br>from dotenv import load_dotenv<br>import os<br><br># Load environment variables from a .env file<br>load_dotenv()<br><br># Configure the generative AI model with the Google API key<br>genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))<br><br># Set up the model configuration for text generation<br>generation_config = {<br> \ "temperature": 0.4,<br> "top_p": 1,<br> "top_k": 32,<br> "max_output_tokens": 4096,<br>}<br><br> # Create a GenerativeModel instance with 'gemini-pro' as the model type<br>llm = genai.GenerativeModel(<br> \ model_name="gemini-pro",<br> generation_config=generation_config,<br> \ )<br> <br>def match_ingredients(user_ingredients, dietary_preferences=None):<br> \ """<br> Matches ingredients with recipes using Gemini Pro (if available).<br><br> Args:<br> user_ingredients (list): List of user-provided ingredients (lowercase and stripped).<br> dietary_preferences (str, optional): User's dietary preferences (e.g., vegetarian, vegan).<br><br> Returns:<br> \ tuple: A tuple containing the recipe name and instructions (if found), otherwise None.<br> """<br> <br> prompt_template = """Find a delicious recipe using these ingredients: {ingredients}. <br> {dietary_preferences_prompt}<br> \ I want the response in a single structured format."""<br><br> \ dietary_preferences_prompt = f"Considering dietary restrictions: {dietary_preferences}" if dietary_preferences else ""<br><br> prompt = prompt_template.format(ingredients=", ".join(user_ingredients), dietary_preferences_prompt=dietary_preferences_prompt)<br><br> \ response = llm.generate_content(prompt)<br><br> # Parse the response from Gemini Pro to extract the matching recipe name and instructions (implementation depends on API response format)<br> recipe = response.text<br> # ... (code to parse response and extract recipe information)<br> return recipe<br><br>st.set_page_config(page_title="Recipe Mixer")<br><br>st.title("Recipe Mixer" + ":sunglasses:")<br>st.markdown('<style>h1{color: orange; text-align: center; font-family:POPPINS}</style>', unsafe_allow_html=True)<br><br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br><br>user_ingred = st.text_input("Enter your ingredients (comma-separated):")<br><br># Add dietary preference dropdown<br>dietary_options = st.selectbox("Dietary Preferences (Optional):", [None, "Vegetarian", "Vegan", "Gluten-Free"])<br><br>submit_button = st.button("Suggest me recipe")<br>user_ingredients = user_ingred.split(", ")<br><br><br>if submit_button:<br> if user_ingred is not None:<br> # Preprocess user ingredients<br> user_ingredients_str = [ingredient.strip().lower() for ingredient in user_ingred.split(", ")]<br> \ <br> # Call match_ingredients once and assign results<br> recipe = match_ingredients(user_ingredients_str, dietary_preferences=dietary_options)<br><br> \ if recipe:<br> complete_recipe = f"\\n{recipe}\\n"<br> \ st.write(complete_recipe.replace('\\\\n', '\\n'))<br> \ else:<br> st.write("No Recipe")<br> <br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br>st.text(" \\n")<br><br>footer="""<style><br>a:link , a:visited{<br>color: yellow;<br>background-color: transparent;<br>text-decoration: underline;<br>}<br><br>a:hover, a:active {<br>color: red;<br>background-color: transparent;<br>text-decoration: underline;<br>}<br><br>.footer {<br>position: Bottom;<br>left: 0;<br>bottom: 0;<br>width: 100%;<br>background-color: transparent;<br>color: white;<br>text-align: center;<br>}<br></style><br><div class="footer"><br><p>Developed with ❤ by<a style='display: block; text-align: center;' href="https://github.com/Gitesh08" target="_blank">Gitesh Mahadik</a></p><br></div><br>"""<br>st.markdown(footer,unsafe_allow_html=True)</pre><p>Create file <strong>requirements.txt</strong> and paste below code.</p><pre>streamlit<br>google-generativeai<br>python-dotenv<br>langchain</pre><p>2. Create a Python virtual environment. Open a new terminal of your editor and paste below command.</p><pre>python -m virtualenv .</pre><p>3. Activate virtual environment. Paste below command in terminal.</p><pre>.\\scripts\\activate</pre><p>4. Install the required dependencies.</p><pre>pip install -r requirements.txt</pre><p>5. Generate Gemini Pro API Key:</p><p><a href=\"https://ai.google.dev/\">Build with the Gemini API | Google AI for Developers</a></p><p>6. Create <strong>.env</strong> file and define your API Key.</p><pre>GOOGLE_API_KEY = "Replace with your API Key"</pre><p>7. Run the application.</p><pre>streamlit run app.py</pre><p>Access the application through your web browser using the provided local address.</p><p><strong>Great! You have successfully built Recipe Mixer using the Gemini Pro LLM model.</strong></p><p><strong>Please give a star to this repo!</strong></p><p><a href=\"https://github.com/Gitesh08/Recipe-Mixer\">GitHub - Gitesh08/Recipe-Mixer</a></p><h4>Usage</h4><ul><li><strong>Input your ingredients:</strong> Enter a list of ingredients you have on hand, separated by commas.</li><li><strong>Specify dietary preferences (optional):</strong> Select your dietary preferences from the dropdown menu.</li><li>Click the <strong>“Suggest me recipe”</strong> button to receive recipe suggestions.</li><li>Explore alternative ingredient suggestions and recipe options.</li><li>Enjoy experimenting with different recipes and ingredients!</li></ul><p><strong>Contributions are welcome! If you have any suggestions, enhancements, or bug fixes, feel free to open an issue or submit a pull request.</strong></p><p>Thank you for reading! I hope you enjoyed this article. If you did, please consider subscribing to my Medium publication. You can also follow me on <a href=\"https://www.linkedin.com/in/gitesh-mahadik%E2%98%81%EF%B8%8F-7487961a0/\">LinkedIn</a> for more updates.</p><p>If you have any questions or feedback, please feel free to leave a comment below. I would love to hear from you!</p><img src=\"https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88fe60836e43\" width=\"1\" height=\"1\" alt=\"\"><hr><p><a href=\"https://medium.com/google-cloud/recipe-mixer-88fe60836e43\">Recipe Mixer\U0001F9D1\U0001F3FB\U0001F373</a> was originally published in <a href=\"https://medium.com/google-cloud\">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>" rss_fields: - title - published - categories - entry_id - content - url - author url: https://medium.com/google-cloud/recipe-mixer-88fe60836e43?source=rss----e52cf94d98af---4 author: Gitesh Mahadik
Language
Active
Ricc internal notes
Imported via /usr/local/google/home/ricc/git/gemini-news-crawler/webapp/db/seeds.d/import-feedjira.rb on 2024-04-05 09:23:04 +0200. Content is EMPTY here. Entried: title,published,categories,entry_id,content,url,author. TODO add Newspaper: filename = /usr/local/google/home/ricc/git/gemini-news-crawler/webapp/db/seeds.d/../../../crawler/out/feedjira/Blogs/Google Cloud - Medium/2024-04-05-Recipe_Mixer-v2.yaml
Ricc source
Show this article
Back to articles