Skip to content

ODSCGoogleHackhathon/googol

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

71 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MedAnnotator

AI-Powered Medical Image Annotation Tool Built by Team Googol for the Agentic AI App Hackathon

๐Ÿ† 2nd Place Winner - ODSC Agentic AI App Hackathon 2024 Official Announcement

CI Python 3.11+ License Hackathon

Overview

MedAnnotator is an LLM-assisted multimodal medical image annotation tool that uses Google Gemini and MedGemma to provide fast, structured, and consistent annotations for medical images (X-rays, CT scans, MRIs).

Key Innovation: Implements a ReAct (Reasoning + Acting) agentic pattern where the system autonomously reasons about medical images, orchestrates specialized tools, and generates standardized JSON outputs.

Why MedAnnotator?

  • Problem: Manual medical image annotation is slow (hours per image), inconsistent, and doesn't scale
  • Solution: AI-powered structured annotation in 2-5 seconds
  • Impact: Faster radiology workflows, better research datasets, improved patient care

โœจ What's New

Latest Developments

Cloud API Integration (December 2024)

  • โ˜๏ธ MedGemma now deployable on Google Cloud Compute Engine
  • ๐Ÿ”„ Automatic fallback: Cloud API โ†’ Local HuggingFace model
  • โšก Faster processing without local GPU requirements
  • ๐Ÿ“– See CLOUD_API_INTEGRATION.md for setup

Two-Tier Agentic Architecture

  • ๐Ÿง  Enhanced agent pipeline with retry logic and validation
  • ๐Ÿ’พ Dual database tables for full traceability (annotation_request + annotation)
  • ๐Ÿค– Medical chatbot with dataset context and tool calling
  • ๐Ÿ“Š Real-time analytics and flagged image tracking

Demo & Documentation

  • ๐ŸŽฌ Complete demo video with timestamp navigation (DEMO.md)
  • ๐Ÿ“š Comprehensive technical documentation
  • ๐Ÿ† 2nd Place in ODSC Agentic AI App Hackathon 2024

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Google Gemini API Key (Get one here)
  • (Optional but recommended) UV for 10x faster installation

Installation

Option 1: With UV (Recommended - 10x faster) โšก

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh  # macOS/Linux
# or: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"  # Windows

# Clone and setup
git clone https://github.com/your-username/googol.git
cd googol

# One-command install
./install.sh

# Or manually
uv sync

# Set up environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY

Option 2: With pip (Traditional)

# Clone the repository
git clone https://github.com/your-username/googol.git
cd googol

# Install dependencies
pip install -r requirements.txt

# Set up environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY

๐Ÿ’ก New to UV? See .claude/UV_SETUP.md for a complete guide!

Running the Application

With Scripts (Auto-detects UV or Python):

# Terminal 1 - Backend
chmod +x run_backend.sh run_frontend.sh
./run_backend.sh

# Terminal 2 - Frontend
./run_frontend.sh

With UV Directly (No activation needed!):

# Terminal 1 - Backend
uv run python -m src.api.main

# Terminal 2 - Frontend
uv run streamlit run src/ui/app.py

With Traditional Python:

# Activate venv first
source .venv/bin/activate  # macOS/Linux
.venv\Scripts\activate     # Windows

# Terminal 1 - Backend
python -m src.api.main

# Terminal 2 - Frontend
streamlit run src/ui/app.py

Access:

Using Docker

# Build and run with Docker Compose
docker-compose up --build

# Or build manually
docker build -t medannotator .
docker run -p 8000:8000 --env-file .env medannotator

๐Ÿ“‹ Features

Agentic Capabilities

  • โœ… ReAct Pattern: Multi-step reasoning (Plan โ†’ Act โ†’ Observe โ†’ Structure)
  • โœ… Tool Orchestration: Automatic MedGemma โ†’ Gemini pipeline
  • โœ… Autonomous Decision Making: Plans annotation strategy independently
  • โœ… Error Recovery: Graceful fallbacks and comprehensive logging
  • โœ… Structured Output: Consistent JSON schema enforcement

Core Features

  • โœ… Medical image upload (JPG, PNG)
  • โœ… AI-powered image analysis (2-5 second processing)
  • โœ… Structured JSON annotation output
  • โœ… Editable results with confidence scores
  • โœ… Downloadable annotations
  • โœ… Human-in-the-loop design

Technical Features

  • โœ… FastAPI async backend
  • โœ… Streamlit interactive frontend
  • โœ… Pydantic data validation
  • โœ… Comprehensive error handling
  • โœ… Full logging and observability
  • โœ… Docker containerization
  • โœ… CI/CD pipeline

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Streamlit Frontend (UI)                      โ”‚
โ”‚              Image Upload โ†’ Results Display โ†’ Edit              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚ HTTP/REST API
                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     FastAPI Backend (API)                       โ”‚
โ”‚            /annotate endpoint โ†’ Request Validation              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  GeminiAnnotationAgent (ReAct)                  โ”‚
โ”‚  Reason โ†’ Act (MedGemma) โ†’ Observe โ†’ Structure (Gemini)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                                โ”‚
              โ–ผ                                โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  MedGemma Tool   โ”‚           โ”‚    Gemini API        โ”‚
    โ”‚ Medical Analysis โ”‚           โ”‚  JSON Structuring    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

See ARCHITECTURE.md for detailed system design.

๐ŸŽฏ Example Output

{
  "patient_id": "P-12345",
  "findings": [
    {
      "label": "Pneumothorax",
      "location": "Right lung apex",
      "severity": "Small"
    },
    {
      "label": "Normal",
      "location": "Cardiac silhouette",
      "severity": "None"
    }
  ],
  "confidence_score": 0.85,
  "generated_by": "MedGemma/Gemini-2.0-Flash",
  "additional_notes": "No other acute abnormalities identified"
}

๐Ÿ“‚ Project Structure

googol/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml              # CI/CD pipeline
โ”œโ”€โ”€ .claude/                    # Additional documentation
โ”‚   โ”œโ”€โ”€ PROJECT_SETUP.md        # Detailed setup guide
โ”‚   โ”œโ”€โ”€ QUICKSTART.md           # 5-minute guide
โ”‚   โ”œโ”€โ”€ TEAM_TASKS.md           # Task distribution
โ”‚   โ””โ”€โ”€ DEMO_GUIDE.md           # Demo preparation
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api/                    # FastAPI backend
โ”‚   โ”‚   โ””โ”€โ”€ main.py             # API endpoints
โ”‚   โ”œโ”€โ”€ agent/                  # Gemini agent (ReAct)
โ”‚   โ”‚   โ””โ”€โ”€ gemini_agent.py     # Orchestration logic
โ”‚   โ”œโ”€โ”€ tools/                  # Tool integrations
โ”‚   โ”‚   โ””โ”€โ”€ medgemma_tool.py    # MedGemma wrapper
โ”‚   โ”œโ”€โ”€ ui/                     # Streamlit frontend
โ”‚   โ”‚   โ””โ”€โ”€ app.py              # UI application
โ”‚   โ”œโ”€โ”€ config.py               # Configuration
โ”‚   โ””โ”€โ”€ schemas.py              # Data models
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ sample_images/          # Test images
โ”‚   โ””โ”€โ”€ annotations/            # Output annotations
โ”œโ”€โ”€ logs/                       # Application logs
โ”œโ”€โ”€ tests/                      # Test suite
โ”œโ”€โ”€ ARCHITECTURE.md             # System architecture โญ
โ”œโ”€โ”€ EXPLANATION.md              # Technical explanation โญ
โ”œโ”€โ”€ DEMO.md                     # Demo video link โญ
โ”œโ”€โ”€ TEST.sh                     # Smoke test script โญ
โ”œโ”€โ”€ Dockerfile                  # Docker configuration โญ
โ”œโ”€โ”€ docker-compose.yml          # Docker Compose config
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ environment.yml             # Conda environment
โ””โ”€โ”€ README.md                   # This file โญ

โญ = Required for hackathon submission

๐Ÿงช Testing

Run the smoke test suite:

chmod +x TEST.sh
./TEST.sh

This will verify:

  • Python version compatibility
  • Required dependencies
  • Module imports
  • Configuration loading
  • Mock tool functionality
  • Documentation completeness

๐Ÿ“š Documentation

Core Documentation

Setup Guides

๐Ÿ† Hackathon Criteria

โœ… Technical Excellence

  • Production-quality code (900+ lines)
  • Comprehensive error handling
  • Full logging and observability
  • Type safety with Pydantic
  • Async API design

โœ… Solution Architecture & Documentation

  • Clear component separation
  • Modular, maintainable design
  • 2000+ lines of documentation
  • ASCII architecture diagrams
  • Complete technical explanations

โœ… Innovative Gemini Integration

  • Gemini 2.0 Flash with JSON mode
  • ReAct pattern for agentic behavior
  • Multi-model orchestration (Gemini + MedGemma)
  • Structured output enforcement
  • Tool calling architecture

โœ… Societal Impact & Novelty

  • Solves real radiology workflow problem
  • Improves annotation consistency
  • Enables better medical research
  • Scalable to thousands of images
  • Human-in-the-loop design for safety

๐ŸŽฌ Demo

๐Ÿ“บ Watch the Demo Video (3:09) | Detailed Timestamps & Analysis

Watch our complete walkthrough showing:

  • Problem statement and solution overview
  • Dataset loading and configuration
  • AI chatbot interaction with tool calling
  • MedGemma analysis and Gemini validation pipeline
  • Real-time structured output generation
  • Edge case handling and human-in-the-loop design
  • Real-world impact

๐Ÿค Team Googol

๐Ÿ† 2nd Place Winners - ODSC Agentic AI App Hackathon 2024

Recognition: Official ODSC LinkedIn Announcement

๐Ÿ› ๏ธ Technology Stack

Core

  • Python 3.11 - Primary language
  • FastAPI - High-performance async web framework
  • Streamlit - Interactive web UI
  • Pydantic - Data validation and settings

AI/ML

  • Google Gemini 2.0 Flash - LLM reasoning and JSON generation
  • MedGemma 4B-IT - Medical specialist model
    • Deployment: HuggingFace (local) or Google Cloud Compute Engine (cloud)
    • Automatic fallback for reliability
  • google-generativeai - Gemini SDK
  • transformers - HuggingFace model loading
  • PyTorch - Deep learning framework

Cloud & Infrastructure

  • Google Cloud Compute Engine - Cloud MedGemma deployment
  • Docker - Containerization
  • GitHub Actions - CI/CD
  • Uvicorn - ASGI server
  • SQLite - Two-tier database architecture

โš ๏ธ Important Notes

Disclaimer

This tool is for research and educational purposes only.

  • NOT FDA approved
  • NOT for clinical diagnosis
  • Requires physician oversight
  • May contain PHI concerns - anonymize data before upload

Current Limitations

  • MedGemma uses mock data (real integration via Vertex AI possible)
  • Stateless design (no annotation history)
  • Single-user sessions
  • Max image size: 10MB recommended

See EXPLANATION.md for detailed limitations and future enhancements.

๐Ÿ”ฎ Future Roadmap

V2.0 (Post-Hackathon)

  • Real MedGemma integration via Vertex AI
  • RAG with medical guidelines
  • Bounding box visualization
  • Annotation history database
  • User authentication

V3.0 (Production)

  • HIPAA compliance
  • FDA validation pathway
  • Multi-user collaboration
  • Batch processing
  • Export to DICOM SR / HL7 FHIR

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Google Gemini Team for the powerful API
  • MedGemma researchers for the specialized medical model
  • FastAPI and Streamlit communities
  • Agentic AI App Hackathon organizers

๐Ÿ“ž Support


Built with โค๏ธ using Google Gemini, FastAPI, and Streamlit

๐Ÿฅ Making medical annotation faster, better, and more accessible.

About

๐Ÿฅ Making medical annotation faster, better, and more accessible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.5%
  • Shell 7.5%