{"id":27295757,"url":"https://github.com/voyrox/sketchcalc","last_synced_at":"2026-04-09T10:47:39.994Z","repository":{"id":249474957,"uuid":"828481905","full_name":"Voyrox/SketchCalc","owner":"Voyrox","description":"Uses machine learning to predict the drawn symbols and converts them into a formal mathematical expression. It then evaluates the expression to provide the calculated answer.","archived":false,"fork":false,"pushed_at":"2024-11-14T09:31:40.000Z","size":112,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T23:13:41.254Z","etag":null,"topics":["machine-learning","mathematics","neural-network","shapes","tensoflow"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Voyrox.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-07-14T09:34:58.000Z","updated_at":"2025-03-11T04:44:29.000Z","dependencies_parsed_at":"2024-07-21T07:22:14.347Z","dependency_job_id":"72345344-30d5-42d7-ac5c-0ac356eea485","html_url":"https://github.com/Voyrox/SketchCalc","commit_stats":null,"previous_names":["frost-lord/sketchcalc","voyrox/sketchcalc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voyrox%2FSketchCalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voyrox%2FSketchCalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voyrox%2FSketchCalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voyrox%2FSketchCalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voyrox","download_url":"https://codeload.github.com/Voyrox/SketchCalc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492877,"owners_count":21113163,"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":["machine-learning","mathematics","neural-network","shapes","tensoflow"],"created_at":"2025-04-11T23:13:45.610Z","updated_at":"2026-04-09T10:47:39.984Z","avatar_url":"https://github.com/Voyrox.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SketchCalc\n\nSketchCalc is an interactive web application that allows users to draw mathematical expressions directly on a canvas. The application uses machine learning to predict the drawn symbols and converts them into a formal mathematical expression. It then evaluates the expression to provide the calculated answer.\n\n![SketchCalc Preview](./img/image.png)\n\n## Features\n\n- **Drawing Canvas**: Users can draw mathematical symbols and expressions on a canvas using mouse input.\n- **Real-time Prediction**: The application predicts the drawn symbols and converts them into mathematical notation.\n- **Bounding Box Calculation**: Drawn symbols are enclosed in bounding boxes to isolate individual symbols.\n- **Integration and Differentiation**: Supports integral and differential calculus with custom variables.\n- **Evaluation**: The predicted mathematical expressions are evaluated to provide the answer.\n- **Custom Variables**: Users can include custom variables in their expressions.\n- **Elapsed Time Measurement**: The time taken to parse and evaluate the drawing is displayed.\n\n## How It Works\n\n1. **Drawing**: Users draw mathematical expressions on the canvas.\n2. **Path Storage**: The paths of the drawings are stored and processed to determine bounding boxes.\n3. **Prediction**: Each bounding box is sent to a server that uses a machine learning model to predict the symbol.\n4. **Display**: The predicted symbols are displayed on the canvas.\n5. **Calculation**: The final expression is evaluated, and the result is displayed to the user.\n\n## Example Usage\n\n- Draw an integral on the canvas, and the application will recognize it as an integral symbol, convert it to the proper mathematical notation, and calculate the result.\n- Use custom variables in your expressions to evaluate them dynamically.\n\n## Technology Stack\n\n- **Frontend**: JavaScript, HTML5 Canvas, CSS\n- **Backend**: Flask (for prediction API)\n- **Machine Learning**: TensorFlow\n\n## Installation\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/Frost-Lord/SketchCalc.git\n    cd SketchCalc\n    ```\n2. Download the model and dataset\n    ```bash\n    https://drive.google.com/drive/folders/1u9L_ByfnE8vfx2AMju7VChWGTsQkbbgm?usp=sharing\n    Extract \"model.keras\" to -\u003e ./\n    Extract \"dataset\" to -\u003e ./\n    ```\n3. Install dependencies:\n    ```bash\n    pip install -r requirements.txt\n    ```\n4. Run the server:\n    ```bash\n    python web.py\n    ```\n5. Open `index.html` in your browser to start drawing and calculating.\n\n\n# Dev Notes:\n\n## Testing on Windows\n```bash\n# Install Python 3.11\nsudo pacman -S python31\n\n# Create a new virtual environment\npython3.11 -m venv .venv\n\n# Activate the virtual environment\n.\\venv\\Scripts\\activate || source venv/bin/activate || source .venv/bin/activate.fish\n\n# Install dependencies\npython -m pip install --upgrade pip setuptools wheel\npython -m pip install opencv-python flask flask_cors pillow \"tensorflow[and-cuda]\"\n\n# Test if the GPU is being detected\npython -c \"import tensorflow as tf; print(tf.__version__); print(tf.config.list_physical_devices('GPU'))\"\n\n# Keras to tflite\npython convert_to_tflite.py -i model.keras -o model.tflite\n```\n\n# Keras to WebModel\n```bash\npython KerasToWebModel.py\n```\n\n##### Dev notes:\n```\nset -gx LD_LIBRARY_PATH (python -c 'import site, glob, os; sp = site.getsitepackages()[0]; print(\":\".join(glob.glob(os.path.join(sp, \"nvidia\", \"*\", \"lib\"))))') $LD_LIBRARY_PATH\npython -c \"import tensorflow as tf; print(tf.__version__); print(tf.config.list_physical_devices('GPU'))\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoyrox%2Fsketchcalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoyrox%2Fsketchcalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoyrox%2Fsketchcalc/lists"}