{"id":19190753,"url":"https://github.com/rtlee9/recipe-summarization","last_synced_at":"2025-10-14T15:08:10.986Z","repository":{"id":93162916,"uuid":"85986842","full_name":"rtlee9/recipe-summarization","owner":"rtlee9","description":"Sequence to sequence recipe summarization","archived":false,"fork":false,"pushed_at":"2018-04-09T05:27:10.000Z","size":133,"stargazers_count":136,"open_issues_count":3,"forks_count":74,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-14T15:07:49.239Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtlee9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-23T18:58:34.000Z","updated_at":"2025-02-26T07:46:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"f66736e7-e60c-49a7-9ae4-958b9e01252e","html_url":"https://github.com/rtlee9/recipe-summarization","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rtlee9/recipe-summarization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtlee9%2Frecipe-summarization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtlee9%2Frecipe-summarization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtlee9%2Frecipe-summarization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtlee9%2Frecipe-summarization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtlee9","download_url":"https://codeload.github.com/rtlee9/recipe-summarization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtlee9%2Frecipe-summarization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019293,"owners_count":26086709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T11:35:40.889Z","updated_at":"2025-10-14T15:08:10.967Z","avatar_url":"https://github.com/rtlee9.png","language":"Python","funding_links":["https://www.buymeacoffee.com/6Ii7vzL"],"categories":[],"sub_categories":[],"readme":"# Recipe summarization\n\nThis repo implements a sequence-to-sequence encoder-decoder using Keras to summarize recipe instructions by predicting a recipe title. This code is based on Siraj Raval's [How to Make a Text Summarizer](https://github.com/llSourcell/How_to_make_a_text_summarizer); it won the coding challenge for that week's [video](https://www.youtube.com/watch?v=ogrJaOIuBx4), and was featured in the following week's [video](https://www.youtube.com/watch?v=nRBnh4qbPHI).\n\n![youtube](youtube_screenshot.jpg)\n\nThis repo has been updated since then, so please check out tag `v1.0.0` to view the version associated with the coding challenge. Lastly, note that this repo is not being actively maintained -- I will do my best to respond to any issues opened but make no guarantees.\n\n**New:** If you're looking to serve your trained model and make its predictions accessible to others, I'd recommend looking into [ServeIt](https://github.com/rtlee9/serveit), an open source library that lets you serve model predictions from a RESTful API using your favorite Python ML library in as little as one line of code. This repository includes an example recipe summarizer server in `src/server.py` for your reference.\n\n## Data\nI scraped 125,000 recipes from various websites for training (additional details can be found [here](https://github.com/rtlee9/recipe-box)). Each recipe consists of:\n\n* A recipe title\n* A list of ingredients\n* Preparation instructions\n* An image of the prepared recipe (missing for ~40% of recipes collected)\n\nThe model was fitted on the recipe ingredients, instructions and title. Ingredients were concatenated in their original order to the instructions. Recipe images were not used for this model.\n\n## Training\nThis model was trained for ~6 hours on an nVidia Tesla K80. Training consisted of several training iterations, in which I successively decremented the learning rate and incremented the ratio of flip augmentations.\n\n## Sampled outputs\nBelow are a few cherry-picked in-sample predictions from the model:\n\n### Example 1:\n* __Generated:__ Chicken Cake\n* __Original:__ Chicken French - Rochester , NY Style\n* __Recipe:__ all purpose flour ; salt ; eggs ; white sugar ; grated parmesan cheese ; olive oil ; skinless ; butter ; minced garlic ; dry sherry ; lemon juice ; low sodium chicken base ; ;Mix together the flour , salt , and pepper in a shallow bowl . In another bowl , whisk beaten eggs , sugar , and Parmesan cheese until the mixture is thoroughly blended and the sugar has dissolved . Heat olive oil in a large skillet over medium heat until the oil shimmers . Dip the chicken breasts into the flour mixture , then into the egg mixture , and gently lay them into the skillet . Pan-fry the chicken breasts until golden brown and no longer pink in the middle , about 6 minutes on each side . Remove from the skillet and set aside . In the same skillet over medium-low heat , melt the butter , and stir in garlic , sherry , lemon juice , and chicken base ...\n\n### Example 2:\n* __Generated:__ Fruit Soup\n* __Original:__ Red Apple Milkshake\n* __Recipe:__ red apple peeled ; cold skim milk ; white sugar ; fresh mint leaves for garnish ; ;In a blender , blend the apple , skim milk , and sugar until smooth . Garnish with mint to serve .\n\n### Example 3:\n* __Generated:__ Asparagus with Chicken\n* __Original:__ Asparagus and Dill Avgolemono Soup\n* __Recipe:__ asparagus ; chicken stock ; unsalted butter ; leek ; onion ; ribs celery ; salt ; water ; eggs ; juice of 2 lemons ; minced fresh dill ; dill sprigs for garnish ;Trim off ends of asparagus and using a vegetable peeler remove about 3 to 4-inches of the skin of each stalk , reserving both the ends and peels . Cut asparagus into 1-inch pieces , reserving tips for garnish . In a saucepan combine the asparagus peels and trimmings with the chicken stock , bring to a boil , remove from heat and allow stock to infuse for 15 minutes . Strain stock and reserve . In a pot of salted boiling water blanch the asparagus tips for 2 to 3 minutes , or until brilliant green and barely tender , and then refresh in a bowl of ice water . When tips are chilled , drain and reserve . In a large heavy pot melt the butter over moderate heat and cook the leeks , onion and celery , seasoned with salt and pepper , until softened , about 5 to 8 minutes . Add the 1-inch asparagus pieces and stir to combine ...\n\n## Usage (Python 3.6)\n\n* Clone repo: `git clone https://github.com/rtlee9/recipe-summarization.git \u0026\u0026 cd recipe-summarization`\n* Initialize submodules: `git submodule update --init --recursive`\n* Install dependencies [optional: in virtualenv]: `pip install -r requirements.txt`\n* Setup directories: `python src/config.py`\n* Download recipes from my Google Cloud Bucket: `wget -P recipe-box/data https://storage.googleapis.com/recipe-box/recipes_raw.zip; unzip recipe-box/data/recipes_raw.zip -d recipe-box/data` (alternatively, see the recipe-box submodule to scrape fresh recipe data)\n* Tokenize data: `python src/tokenize_recipes.py`\n* Initialize word embeddings with GloVe vectors:\n  * Get GloVe vectors: `wget -P data http://nlp.stanford.edu/data/glove.6B.zip; unzip data/glove.6B.zip -d data`\n  * Initialize embeddings: `python src/vocabulary-embedding.py`\n* Train model: `python src/train_seq2seq.py`\n* Make predictions: `python src/predict.py`\n* Serve predictions from RESTful API: `python src/server.py`\n\n## Next steps\nAside from tuning hyperparameters, there are a number of ways to potentially improve this model:\n\n* Incorporate ingredients list non-sequentially, and add recipe images (see [recipe-box](https://github.com/rtlee9/recipe-box))\n* Try different RNN sequence lengths, or [variable sequence lengths](https://danijar.com/variable-sequence-lengths-in-tensorflow/)\n* Try different vocabulary sizes\n\n## Buy me a coffee\nPlease consider buying me a coffee if you like my work:\n\n\u003ca href=\"https://www.buymeacoffee.com/6Ii7vzL\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtlee9%2Frecipe-summarization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtlee9%2Frecipe-summarization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtlee9%2Frecipe-summarization/lists"}