# geshan/image-to-geo-location-llm architecture

> Architecture diagram of the GitHub repository geshan/image-to-geo-location-llm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/geshan/image-to-geo-location-llm
- Repository: https://github.com/geshan/image-to-geo-location-llm

## Overview

##### Frontend Layer
- Streamlit UI Component (represented by streamlit_app.py)
- User interaction flow for image upload and results display

##### Core Processing Layer
- Gemini Integration (represented by gemini.py)
- Image Processing Pipeline
- LLM Interface

##### External Services
- Google Cloud Gemini API
- Cloud Run (deployment platform)

##### Component Organization

**┌─────────────────────────────────────────────────────┐**
- User Interface                     │
- (Streamlit Application)                 │
- ┬─────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Image Processing Pipeline               │
- (gemini.py)                       │
- ┬─────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Gemini LLM API                      │
- (Google Cloud Platform)                  │
- ┘

##### Flow Representation

Following flows:
a. User uploads image → Streamlit UI
b. Streamlit UI → Image Processing Pipeline
c. Image Processing → Gemini LLM API
d. Gemini LLM API → Results
e. Results → Streamlit UI (display)

##### Container Architecture

Since the project includes Dockerfile and docker-compose.yml, show containerization:
- Docker container isolation
- How the container interfaces with external services

##### Deployment View

A separate section showing:
- Cloud Run deployment
- Container registry
- External access points

- Blue: Frontend components
- Green: Processing components
- Yellow: External APIs
- Gray: Infrastructure components

##### Integration points between
- Streamlit and the image processing pipeline
- The processing pipeline and Gemini API
- Container deployment and Cloud Run

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Container["Docker Container Environment"]
        direction TB
        
        subgraph Frontend["Frontend Layer"]
            direction TB
            UI["Streamlit UI"]:::frontend
            Config["Streamlit Config"]:::config
        end

        subgraph Processing["Core Processing Layer"]
            direction TB
            ImagePipeline["Image Processing Pipeline"]:::processing
            GeminiIntegration["Gemini Integration"]:::processing
        end
    end

    subgraph External["External Services"]
        direction TB
        GeminiAPI["Google Cloud Gemini API"]:::external
        CloudRun["Cloud Run"]:::infrastructure
    end

    User((User)):::user
    User -->|Upload Image| UI
    UI -->|Process Image| ImagePipeline
    ImagePipeline -->|Forward to LLM| GeminiIntegration
    GeminiIntegration -->|API Request| GeminiAPI
    GeminiAPI -->|Location Results| GeminiIntegration
    GeminiIntegration -->|Display Results| UI
    Container -->|Deploy| CloudRun

    %% Styling
    classDef frontend fill:#2374ab,stroke:#000,stroke-width:1px,color:#fff
    classDef config fill:#2374ab,stroke:#000,stroke-width:1px,color:#fff,stroke-dasharray: 5 5
    classDef processing fill:#47a025,stroke:#000,stroke-width:1px,color:#fff
    classDef external fill:#f6ae2d,stroke:#000,stroke-width:1px,color:#000
    classDef infrastructure fill:#808080,stroke:#000,stroke-width:1px,color:#fff
    classDef user fill:#fff,stroke:#000,stroke-width:1px,color:#000

    %% Click events for file/directory mapping
    click UI "https://github.com/geshan/image-to-geo-location-llm/blob/master/streamlit_app.py"
    click Config "https://github.com/geshan/image-to-geo-location-llm/blob/master/.streamlit/config.toml"
    click GeminiIntegration "https://github.com/geshan/image-to-geo-location-llm/blob/master/gemini.py"
    click ImagePipeline "https://github.com/geshan/image-to-geo-location-llm/tree/master/images/"

    %% Legend
    subgraph Legend["Legend"]
        direction TB
        Frontend1["Frontend Component"]:::frontend
        Processing1["Processing Component"]:::processing
        External1["External Service"]:::external
        Infrastructure1["Infrastructure"]:::infrastructure
        User1((User)):::user
    end
```
