Butch78 / inspiced-backend

This is a Fastapi + Chef Transformer Application. It will allow you to generate recipes by just passing ingredients to the /generate endpoint. It also has the AWS cdk package allowing you to easily host the application on AWS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inspiced a Chef Transformer Backend

This application allows you to pass through an array of ingredients and it will return a list of recipes that you can make with those ingredients.

Input

 [
    "chicken",
    "onion",
    "garlic",
    "ginger",
    "soy sauce",
    "sesame oil",
    "rice",
    "salt",
    "pepper"
]

Output

[TITLE]: Chicken wings
[INGREDIENTS]:
 - 1: 3 lb. chicken wings
 - 2: 4 tbsp. mazola
 - 3: 2 tbsp. mazola
[DIRECTIONS]:
 - 1: Preheat oven to 350.
 - 2: Arrange wings in single layer on baking pan. bake for 40 minutes or until brown, turning once.
  - 3: Spray cookie sheet with pam and spread chicken wings on pan.
  - 4: Pour 1 teaspoon mazola on each wing and bake for an additional 20 minutes, until chicken is done.
  - 5: Put fried wings on cookie sheet and bake for 2 to 3 minutes.
----------------------------------------------------------------------------------------------------------------------------------

Using this Deployment Guide I was able to create this repository that will allow you to deploy Chef Transformer on AWS.

Missing Features

At the moment the recipes are not stored in a database. They will just be printed to the console. As I do not have access to a database or the resources to host one so I will not be able to implement this feature. If you would like to contribute to this project, please feel free to do so.

Prerequisites for Local Development

  • Python 3.8
  • Docker

Prerequisites for Deployment

  • AWS Account
  • AWS CLI
  • AWS CDK

Deploying Locally with Docker

clone this repository and cd into the directory. You can then run the following command to build the docker image:

docker-compose up --build

You can then access the application at localhost:3000/docs

Deploying to AWS

clone this repository and cd into the directory.

You would need to do the following steps:

  1. Create a virtual environment:

python3 -m venv .env

  1. Activate virtual environment:

source .env/bin/activate

  1. Install the requirements:

pip install -r requirements.txt

  1. Ensure you have the AWS CLI installed and configured with your credentials. You can find the instructions here.

  2. cd into the cdk directory and run the following command:

cdk deploy

The application will be deployed to AWS and you can access the application at the URL provided in the output.

Possible Issues

Chef Transformer is a compute intensive task. You may want to scale the application to handle more requests. This can be modified in the inspiced/cdk/fastapi.py file. You can change the number of tasks and the memory allocated to each task.

About

This is a Fastapi + Chef Transformer Application. It will allow you to generate recipes by just passing ingredients to the /generate endpoint. It also has the AWS cdk package allowing you to easily host the application on AWS.


Languages

Language:Python 96.3%Language:Dockerfile 3.7%