Skip to main content

There’s No AI in Pumpkin Pie, But There Should Be: Delivering Novel Application Experiences Using ML & AI

Share this post

The holiday season is upon us and with it, all the rich and delicious foods that warm our bodies and challenge our waistlines. At Databricks, we wanted to have a little fun and share with our customers some amazing recipes to make the holidays even more delightful. But this being Databricks, we had to go and do so by leveraging AI.

To show the simplicity of AI with Databricks in action, we decided to solve a top-of-mind challenge: How can we make the best pumpkin pie? This blog post walks through how we used the Databricks Serverless Real-Time Interface with powerful open source technologies to build an AI-driven search app.

Meet the Databricks Holiday Recipe Finder app

The Databricks Holiday Recipe Finder app is a simple, AI-driven application that searches for food items based on an image or descriptive text provided by a user. With this app, you can search the Epicurious Food Ingredients and Recipes data set using either image-based search. Upload a picture of your favorite holiday food item - have we mentioned pumpkin pie? - or click on any of the randomly selected images to find recipes for foods similar in appearance to your selected images.  Alternatively, you can use the search box to find recipes based on descriptive words and phrases.

The inspiration for the application was the common challenge of seeing a dish but not quite knowing what it is.  We envisioned - no pun intended - a simple search where you could upload an image of that hard to identify dish, and Databricks could search a vast catalog of food items to find something similar.  For each suggested item, you can see an image to help you get a visual sense of the dish, as well as the ingredients and instructions for its preparation. We’ve already identified more than a few dishes we’ll be adding to our holiday tables this year, and we invite you to do the same.

How we did it

For the app, we leverage over 13K recipes and associated images scraped from the Epicurious website and made available as part of this Kaggle dataset. The image-based search we’ve employed is based on the concept of embeddings. Without getting too technical, you can think of an embedding as a short, mathematical representation of an image or a block of text. When we compare the embeddings associated with two items, the distance between their two embeddings tells us something about the similarity between them.

If that sounds complicated, it needn’t. All the logic and model training required to calculate such embeddings has been tackled by the open source community. Using Databricks, all we need to do is download an appropriately pre-trained model with a single line of code and use it to prepare the data we wish to search.

Once the data is prepared, typically, the challenge would be integrating the model into our application. But once again, Databricks has us covered. Leveraging Databricks’s model serving capabilities, we can wrap our model with a simple API and deploy it to a scalable REST endpoint. It’s a few lines of code followed by a couple clicks in the Databricks UI, and we’re up and running.

Give the Holiday Recipe app a try 

It will take us more time to bake a pumpkin pie than it did to write this application, and that’s really the whole point. At Databricks, our goal is and always has been to simplify the use of machine learning and artificial intelligence. We’ve purposefully built our platform with features intended to make not just the processing of data and training of models easier, but to ensure the insights derived through these can be integrated back into enterprise applications. 

We invite everyone to interact with the application, which we will host throughout the 2022 holiday season, and to download all the code used in its preparation from our public GitHub repository. As you enjoy delicious dishes this holiday season - some of which are hopefully inspired by the app - we invite you to think of all the ways you might leverage data and AI in your applications this coming year. 

To all our customers, we wish you happy holidays! And for those who use the app, we’d love to see what you’ll be cooking! We invite you to share your findings with the hashtag #DatabricksRecipes! 

Try Databricks for free

Related posts

Machine Learning-based Item Matching for Retailers and Brands

Item matching is a core function in online marketplaces. To ensure an optimized customer experience, retailers compare new and updated product information against...

Building a Similarity-based Image Recommendation System for e-Commerce

February 28, 2022 by Avinash Sooriyarachchi in
Why recommendation systems are important Online shopping has become the default experience for the average consumer – even established brick-and-mortar retailers have embraced...
See all Platform Blog posts