This project consists of a Flask backend (for AI-based models) and a React frontend (for user interaction and visualization).
- Python 3.8+ (for backend)
- Node.js 16+ and npm (for frontend)
You will need two separate terminals open at the same time:
- One for the backend (Flask API)
- One for the frontend (React app)
Open a terminal and navigate to the backend directory:
cd backend
Install Python dependencies (only needed the first time):
pip install -r requirements.txt
Run the Flask backend:
python app.py
- This will start the Flask server (by default on http://localhost:5000).
- The API endpoints (e.g.,
/predict
) will be available for the frontend to connect.
Open a second terminal and navigate to the frontend directory:
cd frontend
Install Node dependencies (only needed the first time):
npm install
Run the React frontend:
npm run dev
- This will start the frontend development server (by default on http://localhost:5173 or similar).
- The frontend will connect to the backend API for predictions and reports.
-
Obtain your Groq API key:
- Go to https://console.groq.com/keys and log in.
- Click Create Key if you don't have one.
- Copy your API key (it will start with
gsk_...
).
-
Open the backend code:
cd backend
-
Edit
app.py
and locate the following line:
groq_client = Groq(api_key="YOUR_GROQ_API_KEY_HERE")
- Replace the placeholder with your actual API key:
groq_client = Groq(api_key="gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
-
Save the file.
-
Restart your backend server:
python app.py
- Open your browser and go to the frontend URL (e.g., http://localhost:5173).
- Use the upload page to submit a thermal image and fill in patient details.
- The backend will process the image, run the AI model, and return a detailed report and recommendations.
- Results will be displayed in the frontend.
- Both servers must be running at the same time for the application to work.
- If you change backend code, restart the Flask server.
- If you change frontend code, the Vite dev server will hot-reload automatically.
- Ensure the backend API URL in the frontend code matches your Flask server address (default is
http://localhost:5000
).
- ❗ CORS errors? Make sure
flask-cors
is installed and enabled. - ❗ Model not found? Ensure
thermal.keras
is in the backend directory. - ❗ Dependency issues? Re-run
pip install -r requirements.txt
ornpm install
.
project-root/
│
├── backend/
│ ├── app.py
│ ├── thermal.keras
│ └── ... (other backend files)
│
└── frontend/
├── src/
├── package.json
└── ... (other frontend files)