Culinary Chronicles πŸπŸ€–

*

Culinary Chronicles πŸπŸ€– *

Note: This is a personal project created independently, not affiliated with my employer.

Inspired by the "Retour de Voyage, Les Recettes" book from Social Food, I'm eager to document the dishes that leave a lasting impression during my travels.

I want to try recreating them at home later. To assist me in this endeavor, I created a simple tool: a Google Form connected to OpenAI. It sends a log of recipes straight to my mailbox for future reference

➑️ TRY THE DEMO HERE (V1)

Feedback from a handful of users:

  • Visuals to illustrate each step

  • How can we ensure the recipe is similar to the chef’s recipe?

Feature list for V2:

  • generate visuals of end dish, and each step using a generative AI model

  • Allow user to upload photos of their plates to improve the recipe suggestion, to better tailor to restaurant presentation

  • Migrate to an iOS app with a user friendly recipe reader

Tutorial

The "Culinary Chronicles" prototype leverages a Google Form as an input UI, bypassing the need for a custom web or mobile application. By utilizing Google Cloud Functions for API hosting, I avoided building a server from scratch. Prototyping allows for iterations and adjustments based on actual needs before investing extensive time in development.

Here’s the workflow I followed to build this demo:

  1. Google Form:

    • Created a free Google Form to serve as the front end, collecting the names of dishes, restaurants, and cities. Learn more.

  2. Google Sheets:

    • Linked the Google Form responses to a Google Sheet. Learn more.

  3. Google Apps Script:

    • Set up an extension (Apps Script) on the Google Sheet.

    • Wrote a script in Google Apps Script (which is based on JavaScript) that triggers each time a form is submitted. This script sends a POST HTTP request with a payload containing the submitted email, dish name, restaurant, and city. Learn more.

    • I attached some sample code below πŸ‘€.

  4. Google Cloud Functions:

    • Set up a project on Google Cloud and created a new function. Google provides new customers with $300, which gave me time to understand the technology and evaluate its fit for my project. Learn more.

    • Configured a Python function associated with a URL using the console UI. Any programming language can be used, but I chose Python 3.12. Don’t forget to list your dependencies in the requirements.txt file. Learn more.

    • Used the console to define environmental variables, saving my Gmail SMTP and OpenAI API keys. Learn more.

  5. Python Script for Core Engine:

    • Interfaced with the OpenAI Python library to set up the Assistant, feed prompts, and fetch results. Documentation for setting up an OpenAI developer account and API usage is available. Learn more.

    • Leveraged the newly released GPT-4 models, which are cheaper than GPT-4.

    • I attached some sample code below πŸ‘€.

  6. Email Results:

    • Used SMTP in the Python script to send the results from OpenAI to the participant’s email address. If using a personal Gmail account, you might need to set up an App password due to Google's security protocols. Learn more about Gmail SMTP server and App passwords.

  7. Iteration and Debugging:

    • While this overview presents a linear process, the actual development involved canonical progress. I tackled steps 5 and 6 first, followed by steps 4, 1, 2, and 3, with extensive debugging at each phase. GPT assisted with writing some scripts, which I then tweaked. Note that GPT can be error-prone and may not always have up-to-date library nomenclature, so coding knowledge is crucial.

And voilΓ ! The pipeline is ready. While this summary makes it sound easy, each step involved detailed work and troubleshooting.