Welcome to the Coachbot, a web-based tool that generates personalized workout plans based on user inputs. This app is designed to provide users with a customized training plan based on their goals, preferences, and personal details such as fitness level, frequency, equipment, and intensity.
The app leverages Flask for web interactions, WeasyPrint to create downloadable PDFs, and a custom CoachBot
AI to generate workout plans.
- Form-Based Input: Users fill out a form with their details (name, age, weight, fitness goals, etc.), and the app generates a tailored gym plan.
- AI-Powered Response: The workout plan is generated by an AI model (
CoachBot
) which interprets the user’s input and returns a personalized gym plan. - Downloadable PDF: Users can download their generated gym plan as a professionally formatted PDF.
- Python (3.8+)
- Flask
- WeasyPrint
- dotenv
You can install the dependencies via pip
:
pip install Flask WeasyPrint python-dotenv
-
Clone the Repository:
git clone <repository-url> cd gymplan-generator-app
-
Install Dependencies:
pip install -r requirements.txt
-
Environment Variables:
Ensure a.env
file exists with your environment settings. For example, you can add your app’s secret key:SECRET_KEY=supersecretkey
-
Run the App:
python app.py
This will start the Flask server at
http://127.0.0.1:5000/
.
- Navigate to the app’s homepage (
http://127.0.0.1:5000/
). - Fill out the form with your personal details such as name, age, weight, fitness level, goals, and training preferences.
- Submit the form to receive a personalized gym plan generated by the AI (
CoachBot
). - You can download the gym plan as a PDF by clicking on the "Download PDF" button.
- Method:
GET
,POST
- Description: Renders the main form where users input their details to generate a gym plan.
- Method:
POST
- Description: Handles the form submission, processes the user input, and generates a personalized gym plan using the
CoachBot
. The result is rendered in HTML format on the page.
- Method:
GET
,POST
- Description: Allows the user to download the generated gym plan as a PDF. The HTML response is converted to a styled PDF using WeasyPrint.
├── app/
│ ├── __pycache__/
│ ├── static/
│ │ ├── css/ # Stylesheets (includes gymplan_style_pdf.css)
│ │ └── js/ # Javascript files (if any)
│ ├── templates/ # HTML templates
│ │ ├── gymplan.html
│ │ ├── gymplan2pdf.html
│ │ └── index2.html
│ ├── __init__.py # Initialization for the app (optional, good for scalability)
│ ├── routes.py # Handles the routes (endpoints)
│ ├── forms.py # If you need to handle form validation logic, separate this here (optional)
│ └── utils.py # Helper functions, possibly PDF generation or chatbot interactions
├── coachbot/
│ ├── __init__.py # Init file for CoachBot
│ ├── coach.py # Main CoachBot logic (existing coachbot.py)
│ ├── config.py # Configuration for the bot responses (includes gymplan header/footer)
│ ├── prompts.py # Predefined prompts, if you have many prewritten prompts
├── .env # Environment variables
├── Dockerfile # Docker setup for containerization
├── requirements.txt # Python package dependencies
├── README.md # Documentation (this file)
├── Untitled-1.ipynb # Jupyter notebook (assuming this is for testing/exploring code)
├── cloudbuild.yaml # Cloud build configuration
└── script.sh # Deployment or setup scripts
You can easily customize the form fields or adjust the way the gym plan is generated by editing the relevant sections in app.py
or modifying the CoachBot
in coachbot.py
.
- To modify the user interface, edit
templates/index2.html
. - The structure of the generated gym plan (HTML and PDF) is defined in
config.py
withgymplan_header
andgymplan_tail
for the PDF's header and footer.
To add new fields to the form:
- Add the new input field in the HTML (
index2.html
). - Update the form processing logic in the
/generate_gymplan
route ofapp.py
.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it as needed.
Feel free to reach out with any questions or suggestions! Happy training with your personalized GymPlan! 💪