{"id":27168947,"url":"https://github.com/dhruvbavaliya13/handwritten-digit-predictor","last_synced_at":"2026-05-10T03:51:44.336Z","repository":{"id":286942773,"uuid":"963042959","full_name":"DhruvBavaliya13/handwritten-digit-predictor","owner":"DhruvBavaliya13","description":"🔢 Handwritten Digit Predictor A real-time digit recognition web app using a trained KNN model. Draw a digit on the canvas, and the app predicts it instantly using Flask, OpenCV, and scikit-learn. Perfect for showcasing ML + web integration! 🚀","archived":false,"fork":false,"pushed_at":"2025-04-09T05:02:03.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T05:27:40.966Z","etag":null,"topics":["flask","html","js","machine-learning","pyhton"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/DhruvBavaliya13.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":"2025-04-09T04:24:28.000Z","updated_at":"2025-04-09T05:06:00.000Z","dependencies_parsed_at":"2025-04-09T05:37:43.043Z","dependency_job_id":null,"html_url":"https://github.com/DhruvBavaliya13/handwritten-digit-predictor","commit_stats":null,"previous_names":["dhruvbavaliya13/handwritten-digit-predictor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvBavaliya13%2Fhandwritten-digit-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvBavaliya13%2Fhandwritten-digit-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvBavaliya13%2Fhandwritten-digit-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DhruvBavaliya13%2Fhandwritten-digit-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DhruvBavaliya13","download_url":"https://codeload.github.com/DhruvBavaliya13/handwritten-digit-predictor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247988242,"owners_count":21029075,"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":["flask","html","js","machine-learning","pyhton"],"created_at":"2025-04-09T06:22:09.036Z","updated_at":"2026-05-10T03:51:44.291Z","avatar_url":"https://github.com/DhruvBavaliya13.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖋️ Handwritten Digit Predictor\n\nWelcome to the **Handwritten Digit Predictor** repository! This project uses a **K-Nearest Neighbors (KNN)** algorithm to recognize digits drawn by the user. It combines **machine learning** with a **Flask-based web interface**, allowing users to interactively test handwritten digit predictions.\n\n## 📌 Project Overview\n\nThis project aims to:\n\n- 🧠 Train a **KNN model** to classify handwritten digits using image data.\n- 🎨 Provide a **web interface** where users can draw digits.\n- 🔍 Predict digits in real-time with visual feedback.\n\n## 📂 Dataset\n\nThe model is trained on the **Sklearn Digits Dataset**, which contains:\n\n- 8x8 grayscale images of handwritten digits (0–9)\n- Corresponding labels for each image\n\n## 🛠️ Tech Stack\n\n- **Programming Language**: Python 🐍\n- **Libraries Used**:\n  - `Flask` – to create the web application\n  - `NumPy` – for numerical operations\n  - `OpenCV` – for image preprocessing\n  - `scikit-learn` – for training and saving the KNN model\n\n## 📜 Project Structure\n\n1. 🧪 **Model Training** (`Model_selection.ipynb`) – Trains and evaluates the KNN model  \n2. 🧠 **Model Deployment** – Saved as `knn_model.pkl`  \n3. 🌐 **Web App** (`app.py`) – Flask app to take user input and make predictions  \n4. 🖼️ **Frontend** – HTML/JS canvas for drawing digits (`templates/index.html`)\n\n## 🚀 How to Run\n\n1. Clone this repository:\n   ```sh\n   git clone https://github.com/DhruvBavaliya13/handwritten-digit-predictor.git\n   cd handwritten-digit-predictor\n   ```\n2. Install dependencies:\n   ```sh\n   pip install -r requirements.txt\n   ```\n3. Run the Flask app:\n   ```sh\n   python app.py\n   ```\n4. Open your browser and go to:\n   ```\n   http://127.0.0.1:5000/\n   ```\n\n## ✍️ How It Works\n\n- Use your mouse to draw a digit on the canvas\n- Click **Predict**\n- The KNN model processes the input and returns the predicted digit\n\n## 📸 Sample Interface\n\n![Screenshot 2025-04-09 102347](https://github.com/user-attachments/assets/2e1127a0-9acf-4018-a01b-b1bcc25b0d7b)\n\n## 🤝 Contributing\n\nFeel free to **fork** this repository and submit a pull request if you have ideas to improve the model or the UI!\n\n## 📬 Contact\n\nFor any queries or collaboration opportunities, reach out via:  \n📧 Email: [drbavaliya13@gmail.com](mailto:drbavaliya13@gmail.com)\n\n---\n\n⭐ If you find this project useful, don’t forget to **star** this repository! ⭐\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvbavaliya13%2Fhandwritten-digit-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhruvbavaliya13%2Fhandwritten-digit-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvbavaliya13%2Fhandwritten-digit-predictor/lists"}