Skip to content

Deep7285/GeoCalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📐 Geometry Area & Vision Calculator using GenAI 🤖

A user-friendly web application built with Flask that allows you to calculate the area and volume of various 2D and 3D geometric shapes with customizable units.

Python Flask Gemini Docker Hosted on Hugging Face

✨ Key Features

📏 Standard Geometric Calculations

  • 2D Shapes: Circle, Rectangle/Square, Triangle (Right, Equilateral, Isosceles, Scalene, ASA/SAS), Trapezium, Parallelogram, Pentagon, Hexagon, Rhombus, Ellipse, Sector.
  • 3D Shapes: Sphere, Cylinder, Cuboid, Cone, Pyramid (Surface Area & Volume).
  • Dynamic Conversions: Native support for Meters, Centimeters, Millimeters, Inches, and Feet.

🤖 AI Vision Sketch Recognition (Flagship Feature)

  • Compound Geometry Parsing: user can get answer for messy and hand-drawn complex and compound geometries by uploading/taking image of the sketch or printed shapes using the advanced Vision-Language Model (VLM). (e.g., a rectangle with an attached semicircle).
  • Zero-Retention Architecture: Images are processed strictly in memory using the google-genai SDK and are never stored on the server and can handle ~1000 requests/day.
  • Interactive "Review & Correct" UI: The frontend dynamically generates an input form based on the AI's JSON output, allowing the user to review detected measurements and manually input any missing dimensions before executing the final math.
  • Webpage screenshot Screenshot 2026-04-22 012938

The calculator is live on Hugging Face Spaces: 👉 Geometry Calculator

To run this project on your local machine, follow these steps:

  1. Clone the repository:

    git clone https://huggingface.co/spaces/Deep7285/Geometry-Calculator  
    cd Geometry-Calculator
  2. Create and activate a virtual environment:

    # On Windows:
    python -m venv venv
    .\venv\Scripts\activate
    
    # On macOS/Linux:
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Setup Environment Variables:
    This app requires a Google Gemini API Key to process sketches.
    i. This app requires a Google Gemini API Key to process sketches.
    ii. Add your API key:

    GEMINI_API_KEY=your_actual_api_key_here

    (Note: The .env file is included in .gitignore to prevent secret leakage).

  5. Run the Flask application: for testing run the following in the terminal

    python app.py

    this will open the localhost for test environment

  6. Open your web browser and navigate to http://127.0.0.1:5000/.

🐳 Docker Support

This project includes a production-ready Dockerfile. To run it containerized:

docker build -t geometry-calculator .
docker run -p 7860:7860 -e GEMINI_API_KEY=your_key_here geometry-calculator  

🛠️ Technologies Used

  • Backend: Python 3.11, Flask
  • AI Integration: Google GenAI SDK (gemini-2.5-flash)
  • Computer Vision Processing: OpenCV, Pillow, Numpy
  • Production Server: Gunicorn
  • Frontend: HTML5, CSS3 (Flexbox), Vanilla JavaScript (Dynamic DOM Manipulation)
  • Deployment: Docker Containerized, hosted via Hugging Face Spaces

Designed & Developed by Deep7285

About

A user-friendly web application built with Flask that allows you to calculate the area and volume of various 2D and 3D geometric shapes with customizable units.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors