DermaSeer ML API is a machine learning service for dermatological analysis and prediction. This API provides endpoints for skin condition prediction using machine learning models.
- Clone the repository:
git clone https://github.com/your-username/dermaseer-ml-api.git
cd dermaseer-ml-api
- Install dependencies (for local development):
pip install -r requirements.txt
- Firebase Admin Configuration:
- Go to Firebase Console > Project Settings > Service Accounts
- Generate a new private key
- Save the key as
firebaseAdmin.json
in the project root
Run the application:
python app.py
- Build the Docker image:
docker build -t dermaseer-ml-api:1.0.0 .
- Run the container:
docker run -d -p 5000:5000 --name model-ml-api dermaseer-ml-api:1.0.0
-
Clone Repository to Cloud Shell
-
Create Artifact Registry Repository
gcloud artifacts repositories create dermaseer \ --repository-format=docker \ --location=asia-southeast2
-
Set Up Environment Variables
# Set your project ID export GOOGLE_CLOUD_PROJECT=your-project-id # Set your region export REGION=asia-southeast2 # Set your service name export SERVICE_NAME=dermaseer-ml-api # Setu your Artifact Registry Repository export ARTIFACT_REPO=dermaseer
-
Build and Push Docker Image
gcloud builds submit --tag asia-southeast2-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPO}/dermaseer-ml-api:1.0.0
-
Deploy to Cloud Run
gcloud run deploy ${SERVICE_NAME} \ --image asia-southeast2-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${ARTIFACT_REPO}/dermaseer-ml-api:1.0.0 \ --platform managed \ --region ${REGION} \ --allow-unauthenticated \ --memory 2Gi \ --cpu 2 \ --port 5000
- URL:
/api/predict
- Method:
POST
- Authentication: Bearer Token required
- Request Body:
{ "img_url": "https://storage.googleapis.com/bucket-name/predict/example-image.jpeg" }
- Success Response:
{ "data": { "predicted_acne_type": "Fulminans", "probabilities": { "Fulminans": 0.93, "Fungal": 0.01, "Nodules": 0.0, "Papula": 0.01, "Postula": 0.05 } } }