Skip to content

Ajay9330/teachers_assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

teachers_assistent

An AI powered Assessment Evaluation Framework

Getting Started

This project is a full-stack application with a React frontend and a FastAPI backend.

Prerequisites

  • Python 3.10+
  • Node.js and npm

Backend Setup

  1. Create and activate a virtual environment:

    python3 -m venv backend/venv
    source backend/venv/bin/activate
  2. Install the dependencies:

    pip install -r backend/requirements.txt
  3. Set up your environment:

    • Copy the backend/.env.example file to backend/.env.
    • Fill in the required environment variables:
      • DATABASE_TYPE: The type of database to use (e.g., sqlite, postgres).
      • DATABASE_URL: The connection string for your database.
      • SECRET_KEY: A secret key for JWT authentication.
      • GCS_BUCKET_NAME: The name of your Google Cloud Storage bucket.
      • GEMINI_API_KEY: Your API key for the Gemini model.
      • GCP_PROJECT_ID: Your Google Cloud project ID.
      • GCP_LOCATION: The location of your Google Cloud resources (e.g., us-east4).
      • RAG_CORPUS_DISPLAY_NAME: The display name for your RAG corpus.
      • LOG_LEVEL: The logging level for the application (e.g., INFO, DEBUG).
  4. Run the backend server:

    The application will be available at http://localhost:8001.

    uvicorn backend.app:app --host 0.0.0.0 --port 8001 --reload

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install the dependencies:

    npm install
  3. Run the frontend development server:

    The application will be available at http://localhost:5173 (or another port if 5173 is busy).

    npm run dev

Deployment to Google Cloud Run

This section provides instructions for deploying the application to Google Cloud Run.

Prerequisites

  • A Google Cloud Platform (GCP) project with billing enabled.
  • The Google Cloud SDK installed and configured on your local machine.
  • The gcloud command-line tool authenticated with your GCP account (gcloud auth login).
  • The necessary APIs enabled in your GCP project (Cloud Build, Cloud Run, Artifact Registry, IAM).

Indirect Deployment (via Cloud Build)

This method uses the pre-configured cloudbuild-*.yaml files to automate the build and deployment process.

1. Deploy the Backend

gcloud builds submit --config cloudbuild-backend.yaml .

2. Deploy the Frontend

gcloud builds submit --config cloudbuild-frontend.yaml .

Direct Deployment (Manual Steps)

This method provides the individual commands to build, push, and deploy the Docker images.

1. Deploy the Backend

Build the Docker image:

docker build -t gcr.io/[YOUR_PROJECT_ID]/backend ./backend

Push the image to Google Artifact Registry:

docker push gcr.io/[YOUR_PROJECT_ID]/backend

Deploy the image to Cloud Run:

gcloud run deploy backend \
    --image gcr.io/[YOUR_PROJECT_ID]/backend \
    --region [YOUR_REGION] \
    --platform managed \
    --allow-unauthenticated \
    --service-account [YOUR_SERVICE_ACCOUNT] \
    --set-env-vars-from-file .env

2. Deploy the Frontend

Build the Docker image:

docker build -t gcr.io/[YOUR_PROJECT_ID]/frontend ./frontend

Push the image to Google Artifact Registry:

docker push gcr.io/[YOUR_PROJECT_ID]/frontend

Deploy the image to Cloud Run:

gcloud run deploy frontend \
    --image gcr.io/[YOUR_PROJECT_ID]/frontend \
    --region [YOUR_REGION] \
    --platform managed \
    --allow-unauthenticated

Accessing the Application

Once both the backend and frontend have been successfully deployed, you can access the application using the URL provided by the frontend Cloud Run service. You can find this URL in the GCP console or in the output of the gcloud run deploy command.

About

An AI powered Assessment Evaluation Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors