{"id":18621806,"url":"https://github.com/ahmedsobhy01/digit-classifier","last_synced_at":"2025-04-11T03:30:56.402Z","repository":{"id":251766137,"uuid":"838380642","full_name":"AhmedSobhy01/digit-classifier","owner":"AhmedSobhy01","description":"A \"Hello World\" ML neural network project features a FastAPI docker image for digit predictions and a React frontend where users can draw digits to see instant predictions","archived":false,"fork":false,"pushed_at":"2025-02-03T14:35:11.000Z","size":3381,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T08:38:26.743Z","etag":null,"topics":["digit-classification","digit-recognition","docker","machine-learning","mnist","neural-network","reactjs","tensorflow","typescript"],"latest_commit_sha":null,"homepage":"https://digit-classifier.ahmedsobhy.net","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AhmedSobhy01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-05T14:20:41.000Z","updated_at":"2025-02-03T14:35:14.000Z","dependencies_parsed_at":"2024-09-11T22:31:48.384Z","dependency_job_id":null,"html_url":"https://github.com/AhmedSobhy01/digit-classifier","commit_stats":null,"previous_names":["ahmedsobhy01/digit-classifier"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmedSobhy01%2Fdigit-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmedSobhy01%2Fdigit-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmedSobhy01%2Fdigit-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmedSobhy01%2Fdigit-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AhmedSobhy01","download_url":"https://codeload.github.com/AhmedSobhy01/digit-classifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248335363,"owners_count":21086579,"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":["digit-classification","digit-recognition","docker","machine-learning","mnist","neural-network","reactjs","tensorflow","typescript"],"created_at":"2024-11-07T04:13:42.173Z","updated_at":"2025-04-11T03:30:54.753Z","avatar_url":"https://github.com/AhmedSobhy01.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e🔎 Digit Classifier\u003c/h1\u003e\n\n![screenshot](https://github.com/user-attachments/assets/de0e06fc-7f17-4a47-aabc-ea75e19135ef)\n\nThis project is my \"Hello World\" as a machine learning student. It features a digit classifier powered by a TensorFlow Neural Network, trained on the MNIST dataset. The API is wrapped in a Docker image, and there’s even a cool React frontend where you can draw digits and see instant predictions!\n\n✨ Try the app live at [https://digit-classifier.ahmedsobhy.net](https://digit-classifier.ahmedsobhy.net)\n\n## 📁 Project Structure\n\n-   **`frontend/`** - The React frontend app, where users can draw digits and have fun! 🎨\n-   **`models/`** - TensorFlow model files live here! 🧠\n-   **`server/`** - FastAPI application folder, the brain of our backend! 🖥️\n-   **`docker-compose.yml`** - Docker Compose configuration to build and run both frontend and backend services. 📦\n\n## 🚀 Getting Started\n\n### ✅ Prerequisites\n\n-   **Docker** - To build and run the API in a container. 🐋\n-   **Node.js and npm** - For building the frontend application. 📦\n\n### 🛠️ Building and Running the Application with Docker Compose\n\n1. **Clone the repository**:\n\n    ```bash\n    git clone https://github.com/AhmedSobhy01/digit-classifier.git\n    cd digit-classifier\n    ```\n\n2. **Build and start the services**:\n\n    ```bash\n    docker-compose up --build -d\n    ```\n\n    This command builds the Docker images for both the React frontend and the FastAPI backend, then starts the services defined in `docker-compose.yml`.\n\n3. **Access the services**:\n\n    - **React Frontend**: Open `http://localhost:3000` in your browser to use the frontend app.\n    - **FastAPI Backend**: The backend API will be accessible at `http://localhost:5000`.\n\n### 🔗 API Endpoints\n\n-   **POST /predict**: Predict the digit from an uploaded image file. 📸\n\n    #### Example Request\n\n    ```bash\n    curl -X POST \"http://localhost:5000/predict\" -H \"Content-Type: multipart/form-data\" -F \"file=@your_image_file.png\"\n    ```\n\n    -   **`file`**: The image file you want to classify. 🎯\n\n    #### Example Response\n\n    ```json\n    {\n        \"message\": \"Prediction successful\",\n        \"prediction\": 1,\n        \"probabilities\": [2.6359641196904704e-5, 0.7292985916137695, 3.460873995209113e-5, 0.10600192844867706, 0.005066428333520889, 0.053292419761419296, 3.709441443788819e-6, 0.002449796535074711, 0.005420663394033909, 0.09840560704469681]\n    }\n    ```\n\n## 🎨 Building the Frontend Web Application (Optional)\n\nIf you prefer to build and run the React frontend without Docker, follow these steps:\n\n1. **Navigate to the `frontend` directory**:\n\n    ```bash\n    cd frontend\n    ```\n\n2. **Install the necessary dependencies**:\n\n    ```bash\n    npm install\n    ```\n\n3. **Build the frontend application**:\n\n    ```bash\n    npm run build\n    ```\n\n4. **Serve the application locally**:\n\n    ```bash\n    npm start\n    ```\n\n    The frontend app will be available at `http://localhost:3000` (port may vary).\n\n## 🌐 Live Demo\n\nNo need to set up locally? Try the live version here: [https://digit-classifier.ahmedsobhy.net/](https://digit-classifier.ahmedsobhy.net/).\n\n## 🧠 Model Architecture\n\nThe neural network model used is a simple yet powerful one:\n\n-   **Input Layer**: 784 neurons (28x28 pixels, flattened)\n-   **Hidden Dropout Layer**\n-   **Hidden Dense Layer**: 1 fully connected layer with ReLU activation\n-   **Output Layer**: 10 neurons (one for each digit class) with softmax activation\n\n## 🎓 Model Training\n\nThe model was trained using the MNIST dataset. Want to retrain it? Use the `models/tensorflow_nn_model.py` script.\n\n## 📜 License\n\nThis project is licensed under the MIT License. For more details, see the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedsobhy01%2Fdigit-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmedsobhy01%2Fdigit-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedsobhy01%2Fdigit-classifier/lists"}