Skip to content

HamzaGiTX786/Course-Rec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CourseRec

A chatbot for TrentU students that will assist in choosing courses

This is a full-stack web application with a Django backend and a React frontend. The backend provides a RESTful API using Django REST Framework, and the frontend is built with React and communicates with the backend via API calls.


📁 Project Structure

root/
├── backend/       # Django project
|   ├── conversations/
|   |   └── ...
|   ├── recommendation/
|   |   └── ...
|   ├── users/
|   |   └── ...
│   ├── courserec/
│   |   └── ...
|   ├── manage.py
|   └── .env
├── data/
|   └── ...
├── docker/
|   └── docker-compose.yml
├── frontend/      # React app (Create React App)
|   ├── courserec
|   │   ├── package.json
|   |   ├── public/
|   │   └── src/
|   │       └── ...
├── fine-tuning
|   ├── fine-tuning-gpt04mini.py
|   ├── testing-fine-tuned-model.py
├── pre-processing
|   ├── chattypeconversion.py
|   ├── question.py
|   ├── train_val_spilt.py
|   └──validate.py
├── README.md
├── requirements.txt
└── .gitignore

🚀 Getting Started

✅ Prerequisites

  • Python 3.8+
  • Node.js 14+
  • npm or yarn
  • pip
  • docker

🔒 .env file

Create a .env file in the backend directory as show in the Project Structure. Inside the .env file store your OPENAI API key as such

OPENAI_API_KEY = ....

⚙️ Fine-tune an OPENAI LLM Model

  1. This chatbot works using a fine-tuned LLM model. To fine tune your LLM model, use the train.jsonl and val.jsonl files in the data directory.
  2. To fine-tune your model, please refer to the OPENAI API docs
  3. Replace the name of your fine-tuned model with ft:gpt-4o-mini-2024-07-18:hamza::AwwppreQ in the backend/recommend/usemodel.py file

📦 Setting up the a Virtual Environment

  1. Create a virtual environment and activate it:
python -m venv env
source env/bin/activate  # On Windows: env\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

📊 MySQL Database Setup (via Docker)

  1. Navigate to the docker directory:
cd docker
  1. Start the container
docker-compose -f docker-compose.yml up

🔧 Backend Setup (Django)

  1. Navigate to the backend directory:
cd backend
  1. Apply migrations and run the server:
python manage.py migrate
python manage.py runserver

The backend server will run at: http://127.0.0.1:8000/


💻 Frontend Setup (React)

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev

The frontend will run at: http://localhost:5173/


🔗 Connecting Frontend and Backend

Ensure that API calls from React are directed to the correct backend URL. You can use environment variables (.env) or proxy settings in package.json:

"proxy": "http://127.0.0.1:8000"

🛠️ Build for Production

Backend

  • Collect static files:
python manage.py collectstatic

Frontend

  • Build React app:
npm run build 
  • Copy the contents of frontend/build/ into Django's static directory or configure Django to serve it.

TODO


🔪 Testing

Backend

python manage.py test

Frontend

npm test  # or yarn test

📄 License

This project is licensed under the MIT License


🤛️ Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.


✨ Acknowledgments

About

A chatbot for TrentU students that will assist in choosing courses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published