Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 2.6 KB

README.md

File metadata and controls

49 lines (30 loc) · 2.6 KB

Serverless AI Fitness

Would you like to say your workouts are created by AI? Cool, me too! And now we can!

Using the OpenAI API, this solution will query ChatGPT to build workouts for you that use equipment you have at your disposal.

For more details, please refer to this blog post.

How It Works

This solution is powered by two Step Functions:

  1. Generate Weekly Schedule - Randomizes which muscle groups, workout types, and equipment will be on each day and gets the workout from ChatGPT
  2. Daily Workout Notifier - Sends an email in the evening with the workout details for the next day

Architecture of the two Step Function workflows

Deployment

This is a complete solution with both a user interface and back-end service. To deploy the entire application, you can hook up the repository to an Amplify build. However if you'd rather only deploy the service, you can do so with the following commands:

cd back-end
sam build
sam deploy --guided

Deployment Variables

To successfully deploy the solution, you must provide the following deployment variables

  • TableName - Name of the table in DynamoDB, defaults to ai-fitness
  • OpenAIApiKey - API Key used to interact with ChatGPT. More on this here
  • MomentoAuthToken - Auth token used to cache ChatGPT responses. Generate your token
  • ContactEmail - The email address you wish to send workouts to

NOTE - This solution relies on the email configuration from this repo to send emails. The stack from that repo must be deployed for emails to be sent. An alternative would be to copy the SendEmailFunction from that repo into this one.

Configuring

You can configure several aspects of this application.

Cost

For the most part, this solution is free. It falls under the free tier for the AWS infrastructure, Momento cache, and SendGrid email allowance. However, this will cost a few cents per month in OpenAI.