# kos0-col/app-restaurador-ia architecture

> Architecture diagram of the GitHub repository kos0-col/app-restaurador-ia, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kos0-col/app-restaurador-ia
- Repository: https://github.com/kos0-col/app-restaurador-ia

## Overview

Restaurador IA is a public Django web app for uploading old photos and choosing colorization, restoration, or both. Its main flow validates an upload, saves the original and a processing session, invokes the selected AI service, stores the result, then renders an original/result comparison with a download link. The README documents DeOldify and CodeFormer Gradio integrations and automatic retries. Sampled views and service code support the main wiring; the template and model implementation were not sampled, so their finer behavior is inferred only from documented features and use sites.

Main entry points: [`procesador/views.py`](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/views.py) (Request handlers), [`procesador/services.py`](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/services.py) (Image services), [`procesador/urls.py`](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/urls.py) (App routes), [`procesador/templates/procesador/inicio.html`](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/templates/procesador/inicio.html) (Comparison UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_routes["App routes<br/>[urls.py]"]
  node_views["Request handlers<br/>[views.py]"]
  node_form["Upload form<br/>[forms.py]"]
  node_page["Comparison UI<br/>[inicio.html]"]
end

subgraph group_workflow["Processing workflow"]
  node_settings["App settings<br/>[settings.py]"]
  node_services["Image services<br/>[services.py]"]
end

subgraph group_state["Files and state"]
  node_session[("Processing session<br/>[models.py]")]
  node_uploads[("Original images")]
  node_results[("Processed images")]
end

subgraph group_integrations["AI integrations"]
  node_hf{{"Hugging Face Spaces"}}
end

node_visitor(("Visitor"))

node_visitor -->|"requests"| node_routes
node_routes -->|"dispatches"| node_views
node_views -->|"validates with"| node_form
node_views -->|"renders"| node_page
node_views -->|"saves original"| node_uploads
node_views -->|"creates and updates"| node_session
node_views -->|"invokes preset"| node_services
node_services -->|"reads API config"| node_settings
node_services -->|"uploads image"| node_hf
node_services -->|"requests prediction"| node_hf
node_services -->|"downloads output"| node_hf
node_views -->|"saves output"| node_results
node_views -->|"loads result session"| node_session
node_views -->|"reads original"| node_uploads
node_views -->|"reads processed image"| node_results
node_page -->|"shows comparison and download"| node_visitor

click node_routes "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/urls.py"
click node_views "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/views.py"
click node_form "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/forms.py"
click node_page "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/templates/procesador/inicio.html"
click node_settings "https://github.com/kos0-col/app-restaurador-ia/blob/master/config/settings.py"
click node_services "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/services.py"
click node_session "https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/models.py"
click node_uploads "https://github.com/kos0-col/app-restaurador-ia/tree/master/media/subidas"
click node_results "https://github.com/kos0-col/app-restaurador-ia/tree/master/media/resultados"

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_routes,node_views,node_form,node_page toneBlue
class node_settings,node_services toneAmber
class node_session,node_uploads,node_results toneMint
class node_hf toneRose
class node_visitor toneIndigo
```

## Components

### Web interface

- [App routes](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/urls.py): `procesador/urls.py`
- [Request handlers](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/views.py): `procesador/views.py`
- [Upload form](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/forms.py): `procesador/forms.py`
- [Comparison UI](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/templates/procesador/inicio.html): `procesador/templates/procesador/inicio.html`

### Processing workflow

- [App settings](https://github.com/kos0-col/app-restaurador-ia/blob/master/config/settings.py): `config/settings.py`
- [Image services](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/services.py): `procesador/services.py`

### Files and state

- [Processing session](https://github.com/kos0-col/app-restaurador-ia/blob/master/procesador/models.py): `procesador/models.py`
- [Original images](https://github.com/kos0-col/app-restaurador-ia/tree/master/media/subidas): `media/subidas`
- [Processed images](https://github.com/kos0-col/app-restaurador-ia/tree/master/media/resultados): `media/resultados`

### AI integrations

- **Hugging Face Spaces**

### Other components

- **Visitor**

## Connections

- Visitor → App routes: requests
- App routes → Request handlers: dispatches
- Request handlers → Upload form: validates with
- Request handlers → Comparison UI: renders
- Request handlers → Original images: saves original
- Request handlers → Processing session: creates and updates
- Request handlers → Image services: invokes preset
- Image services → App settings: reads API config
- Image services → Hugging Face Spaces: uploads image
- Image services → Hugging Face Spaces: requests prediction
- Image services → Hugging Face Spaces: downloads output
- Request handlers → Processed images: saves output
- Request handlers → Processing session: loads result session
- Request handlers → Original images: reads original
- Request handlers → Processed images: reads processed image
- Comparison UI → Visitor: shows comparison and download
