The vacation season is upon us and with it, all of the wealthy and scrumptious meals that heat our our bodies and problem our waistlines. At Databricks, we wished to have slightly enjoyable and share with our clients some superb recipes to make the vacations much more pleasant. However this being Databricks, we needed to go and accomplish that by leveraging AI.
To point out the simplicity of AI with Databricks in motion, we determined to unravel a top-of-mind problem: How can we make the very best pumpkin pie? This weblog submit walks via how we used the Databricks Serverless Actual-Time Interface with highly effective open supply applied sciences to construct an AI-driven search app.
Meet the Databricks Vacation Recipe Finder app
The Databricks Vacation Recipe Finder app is a straightforward, AI-driven utility that searches for meals gadgets primarily based on a picture or descriptive textual content offered by a consumer. With this app, you may search the Epicurious Meals Components and Recipes knowledge set utilizing both image-based search. Add an image of your favourite vacation meals merchandise – have we talked about pumpkin pie? – or click on on any of the randomly chosen pictures to seek out recipes for meals related in look to your chosen pictures. Alternatively, you need to use the search field to seek out recipes primarily based on descriptive phrases and phrases.
The inspiration for the appliance was the widespread problem of seeing a dish however not fairly figuring out what it’s. We envisioned – no pun meant – a easy search the place you possibly can add a picture of that tough to establish dish, and Databricks might search an unlimited catalog of meals gadgets to seek out one thing related. For every recommended merchandise, you may see a picture that can assist you get a visible sense of the dish, in addition to the components and directions for its preparation. We’ve already recognized quite a lot of dishes we’ll be including to our vacation tables this 12 months, and we invite you to do the identical.
How we did it
For the app, we leverage over 13K recipes and related pictures scraped from the Epicurious web site and made obtainable as a part of this Kaggle dataset. The image-based search we’ve employed relies on the idea of embeddings. With out getting too technical, you may consider an embedding as a brief, mathematical illustration of a picture or a block of textual content. After we evaluate the embeddings related to two gadgets, the gap between their two embeddings tells us one thing in regards to the similarity between them.
If that sounds sophisticated, it needn’t. All of the logic and mannequin coaching required to calculate such embeddings has been tackled by the open supply neighborhood. Utilizing Databricks, all we have to do is obtain an appropriately pre-trained mannequin with a single line of code and use it to organize the information we want to search.
As soon as the information is ready, usually, the problem can be integrating the mannequin into our utility. However as soon as once more, Databricks has us lined. Leveraging Databricks’s mannequin serving capabilities, we are able to wrap our mannequin with a easy API and deploy it to a scalable REST endpoint. It’s a couple of strains of code adopted by a pair clicks within the Databricks UI, and we’re up and working.
Give the Vacation Recipe app a attempt
It should take us extra time to bake a pumpkin pie than it did to jot down this utility, and that’s actually the entire level. At Databricks, our purpose is and all the time has been to simplify the usage of machine studying and synthetic intelligence. We’ve purposefully constructed our platform with options meant to make not simply the processing of knowledge and coaching of fashions simpler, however to make sure the insights derived via these could be built-in again into enterprise purposes.
We invite everybody to work together with the appliance, which we are going to host all through the 2022 vacation season, and to obtain all of the code utilized in its preparation from our public GitHub repository. As you get pleasure from scrumptious dishes this vacation season – a few of that are hopefully impressed by the app – we invite you to consider all of the methods you may leverage knowledge and AI in your purposes this coming 12 months.
To all our clients, we want you cheerful holidays! And for individuals who use the app, we’d like to see what you’ll be cooking! We invite you to share your findings with the hashtag #DatabricksRecipes!