# mikkelmiksen/python-server-part architecture

> Architecture diagram of the GitHub repository mikkelmiksen/python-server-part, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mikkelmiksen/python-server-part
- Repository: https://github.com/mikkelmiksen/python-server-part

## Overview

This repository provides single-image 3D reconstruction using TripoSR, through both a FastAPI service and a standalone script. A client uploads an image; the service decodes it, calls shared helpers to preprocess it and generate a mesh, then returns binary GLB. The helpers also load and warm the model at startup. The script runs a similar reconstruction path and writes an OBJ file. The TripoSR implementation is present as a submodule directory, but its source was not sampled; connections to it are limited to calls visible in the provided files.

Main entry points: [`main.py`](https://github.com/mikkelmiksen/python-server-part/blob/main/main.py) (Standalone runner), [`server.py`](https://github.com/mikkelmiksen/python-server-part/blob/main/server.py) (FastAPI service), [`triposr_helpers.py`](https://github.com/mikkelmiksen/python-server-part/blob/main/triposr_helpers.py) (Model lifecycle), [`TripoSR`](https://github.com/mikkelmiksen/python-server-part/tree/main/TripoSR) (TripoSR engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Entry points"]
  node_api["FastAPI service<br/>[server.py]"]
  node_script["Standalone runner<br/>[main.py]"]
end

subgraph group_processing["Reconstruction"]
  node_helpers["Model lifecycle<br/>[triposr_helpers.py]"]
  node_preprocessing["Image preprocessing<br/>[triposr_helpers.py]"]
  node_engine["TripoSR engine"]
  node_background["Background removal"]
end

subgraph group_results["Mesh outputs"]
  node_glb["GLB response"]
  node_obj["OBJ mesh file<br/>[mesh.obj]"]
end

node_client(("API client"))

node_client -->|"uploads image"| node_api
node_api -->|"loads and invokes"| node_helpers
node_helpers -->|"preprocesses image"| node_preprocessing
node_preprocessing -->|"removes background"| node_background
node_helpers -->|"loads and runs"| node_engine
node_api -->|"serializes and returns"| node_glb
node_script -->|"processes image"| node_preprocessing
node_script -->|"loads and runs"| node_engine
node_script -->|"exports mesh"| node_obj

click node_api "https://github.com/mikkelmiksen/python-server-part/blob/main/server.py"
click node_script "https://github.com/mikkelmiksen/python-server-part/blob/main/main.py"
click node_helpers "https://github.com/mikkelmiksen/python-server-part/blob/main/triposr_helpers.py"
click node_preprocessing "https://github.com/mikkelmiksen/python-server-part/blob/main/triposr_helpers.py"
click node_engine "https://github.com/mikkelmiksen/python-server-part/tree/main/TripoSR"
click node_obj "https://github.com/mikkelmiksen/python-server-part/blob/main/output/0/mesh.obj"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_script,node_client toneBlue
class node_helpers,node_preprocessing,node_engine,node_background toneAmber
class node_glb,node_obj toneMint
```

## Components

### Entry points

- [FastAPI service](https://github.com/mikkelmiksen/python-server-part/blob/main/server.py): `server.py`
- [Standalone runner](https://github.com/mikkelmiksen/python-server-part/blob/main/main.py): `main.py`

### Reconstruction

- [Model lifecycle](https://github.com/mikkelmiksen/python-server-part/blob/main/triposr_helpers.py): `triposr_helpers.py`
- [Image preprocessing](https://github.com/mikkelmiksen/python-server-part/blob/main/triposr_helpers.py): `triposr_helpers.py`
- [TripoSR engine](https://github.com/mikkelmiksen/python-server-part/tree/main/TripoSR): `TripoSR`
- **Background removal**

### Mesh outputs

- **GLB response**
- [OBJ mesh file](https://github.com/mikkelmiksen/python-server-part/blob/main/output/0/mesh.obj): `output/0/mesh.obj`

### Other components

- **API client**

## Connections

- API client → FastAPI service: uploads image (evidence: `server.py`)
- FastAPI service → Model lifecycle: loads and invokes (evidence: `server.py`)
- Model lifecycle → Image preprocessing: preprocesses image (evidence: `triposr_helpers.py`)
- Image preprocessing → Background removal: removes background (evidence: `triposr_helpers.py`)
- Model lifecycle → TripoSR engine: loads and runs (evidence: `triposr_helpers.py`)
- FastAPI service → GLB response: serializes and returns (evidence: `server.py`)
- Standalone runner → Image preprocessing: processes image (evidence: `main.py`)
- Standalone runner → TripoSR engine: loads and runs (evidence: `main.py`)
- Standalone runner → OBJ mesh file: exports mesh (evidence: `main.py`)
