{"id":23084729,"url":"https://github.com/sealonk/mlgc-server","last_synced_at":"2026-05-04T00:31:48.879Z","repository":{"id":265005314,"uuid":"894673575","full_name":"Sealonk/mlgc-server","owner":"Sealonk","description":"Backend server for skin cancer detection using TensorFlow.js and Firebase.","archived":false,"fork":false,"pushed_at":"2024-12-14T06:05:31.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T15:13:01.568Z","etag":null,"topics":["backend","express","firebase","healthcare","image-processing","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sealonk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-26T19:22:36.000Z","updated_at":"2024-12-14T06:05:35.000Z","dependencies_parsed_at":"2025-02-09T03:42:51.947Z","dependency_job_id":"da50e5ee-9fb8-44dd-8449-f6a11ea1a663","html_url":"https://github.com/Sealonk/mlgc-server","commit_stats":null,"previous_names":["sealonk/mlgc-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sealonk%2Fmlgc-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sealonk%2Fmlgc-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sealonk%2Fmlgc-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sealonk%2Fmlgc-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sealonk","download_url":"https://codeload.github.com/Sealonk/mlgc-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247024152,"owners_count":20870940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","express","firebase","healthcare","image-processing","machine-learning","tensorflow"],"created_at":"2024-12-16T16:42:59.083Z","updated_at":"2025-10-05T09:28:46.851Z","avatar_url":"https://github.com/Sealonk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mlgc-server - Skin Cancer Detection API\n\nThis repository provides a backend server for skin cancer detection using machine learning. It uses TensorFlow.js to load a pre-trained model, processes image uploads, and returns predictions (Cancer or Non-cancer). The predictions are then stored in Firebase Firestore for later access.\n\n## Features\n\n- **Image Upload**: Users can upload an image for prediction.\n- **Prediction**: The server uses a pre-trained TensorFlow.js model to classify images as either \"Cancer\" or \"Non-cancer\".\n- **Prediction History**: The server stores predictions in Firebase Firestore, and users can retrieve a list of all past predictions.\n\n## Technologies Used\n\n- [Express.js](https://expressjs.com/): Web framework for building the API.\n- [TensorFlow.js](https://www.tensorflow.org/js): JavaScript library for machine learning.\n- [Firebase](https://firebase.google.com/): Used for storing prediction data in Firestore.\n- [Multer](https://www.npmjs.com/package/multer): Middleware for handling file uploads.\n- [Sharp](https://sharp.pixelplumbing.com/): Image processing library for image validation and resizing.\n\n## Setup\n\n### 1. Clone the repository\n\n```bash\ngit clone https://github.com/Sealonk/mlgc-server.git\n```\n\n### 2. Install dependencies\n\n```bash\ncd mlgc-server\nnpm install\n```\n\n### 3. Firebase Setup\n\n- You need a Firebase project. Create a new project or use an existing one.\n- Create a service account in the Firebase Console, download the service account key, and place it in the root directory as `serviceAccountKey.json`.\n\n### 4. Set up model\n\n- The model used for predictions is hosted on Google Cloud Storage. You can specify the model URL in `index.js` under the `MODEL_URL` constant.\n\n### 5. Run the application\n\n```bash\nnpm run start\n```\n\nThe server will start running at http://localhost:8080.\n\n### 6. Use the Prediction API\n\n#### `POST /predict`\n\nSend an image to the `/predict` endpoint to get a prediction.\n\n##### Request:\n```bash\ncurl -X POST http://localhost:8080/predict -F \"image=@path/to/your/image.jpg\"\n```\n\n##### Response:\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"Model is predicted successfully\",\n  \"data\": {\n    \"id\": \"prediction_id\",\n    \"result\": \"Cancer\",\n    \"suggestion\": \"Segera periksa ke dokter!\",\n    \"createdAt\": \"2024-12-14T12:00:00Z\"\n  }\n}\n```\n\n#### `GET /predict/histories`\n\nTo fetch all prediction histories:\n```bash\ncurl -X GET http://localhost:8080/predict/histories\n```\n\n##### Response:\n```json\n{\n  \"status\": \"success\",\n  \"data\": [\n    {\n      \"id\": \"prediction_id\",\n      \"result\": \"Non-cancer\",\n      \"suggestion\": \"Penyakit kanker tidak terdeteksi.\",\n      \"confidence\": 0.75,\n      \"createdAt\": \"2024-12-14T12:00:00Z\"\n    },\n    ...\n  ]\n}\n```\n\n## Folder Structure\n\n```bash\n- node_modules/\n- src/\n  - firebase.js             # Firebase initialization and Firestore setup\n  - index.js                # Express server and prediction logic\n  - predictionService.js    # Logic for saving predictions to Firestore\n- .gitignore                # Git ignore file\n- package.json              # Project metadata and dependencies\n- package-lock.json         # Lock file for npm dependencies\n- README.md                 # Project documentation\n- serviceAccountKey.json    # Firebase service account key (not to be shared publicly)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsealonk%2Fmlgc-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsealonk%2Fmlgc-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsealonk%2Fmlgc-server/lists"}