# skkrishn1/multilingual-translator-speech-synthesizer architecture

> Architecture diagram of the GitHub repository skkrishn1/multilingual-translator-speech-synthesizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skkrishn1/multilingual-translator-speech-synthesizer
- Repository: https://github.com/skkrishn1/multilingual-translator-speech-synthesizer

## Overview

This is a Streamlit application that accepts pasted text or uploaded documents, translates the content, and optionally generates downloadable speech. The main flow is user input → extraction when needed → translation → optional audio. The README documents caching and session-state results; sampled excerpts show the UI dispatching work to the processing modules. Some wiring is supported by the SOURCE INDEX or README rather than complete source excerpts, so the graph omits unverified details.

Main entry points: [`app.py`](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/app.py) (Streamlit app), [`src/translator.py`](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/translator.py) (Chunked translation), [`src/tts.py`](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/tts.py) (Speech synthesis), [`src/extractors.py`](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/extractors.py) (Document extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_session["Result state<br/>[app.py]"]
end

subgraph group_language_input["Input and language"]
  node_extractors["Document extraction<br/>[extractors.py]"]
  node_languages["Language registry<br/>[languages.py]"]
end

subgraph group_translation["Translation"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_translator["Chunked translation<br/>[translator.py]"]
end

subgraph group_speech["Speech"]
  node_tts["Speech synthesis<br/>[tts.py]"]
end

node_user(("User"))
node_gemini{{"Gemini API"}}
node_speech_service{{"Google speech service"}}

node_user -->|"enters text"| node_app
node_app -->|"extracts upload"| node_extractors
node_extractors -->|"returns text"| node_app
node_app -->|"looks up language"| node_languages
node_app -->|"requests translation"| node_translator
node_translator -->|"sends chunks"| node_gemini
node_gemini -->|"returns translation"| node_translator
node_translator -->|"reads limits and models"| node_config
node_translator -->|"returns result"| node_app
node_app -->|"stores results"| node_session
node_app -->|"requests audio"| node_tts
node_tts -->|"reads chunk limit"| node_config
node_tts -->|"synthesizes speech"| node_speech_service
node_tts -->|"returns MP3"| node_app

click node_app "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/app.py"
click node_session "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/app.py"
click node_extractors "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/extractors.py"
click node_languages "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/languages.py"
click node_config "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/config.py"
click node_translator "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/translator.py"
click node_tts "https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/tts.py"

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_app,node_session,node_user toneBlue
class node_extractors,node_languages toneAmber
class node_config,node_translator,node_gemini toneMint
class node_tts toneRose
class node_speech_service toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/app.py): `app.py`
- [Result state](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/app.py): `app.py`

### Input and language

- [Document extraction](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/extractors.py): `src/extractors.py`
- [Language registry](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/languages.py): `src/languages.py`

### Translation

- [Runtime configuration](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/config.py): `src/config.py`
- [Chunked translation](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/translator.py): `src/translator.py`

### Speech

- [Speech synthesis](https://github.com/skkrishn1/multilingual-translator-speech-synthesizer/blob/main/src/tts.py): `src/tts.py`

### Other components

- **User**
- **Gemini API**
- **Google speech service**

## Connections

- User → Streamlit app: enters text (evidence: `README.md`)
- Streamlit app → Document extraction: extracts upload (evidence: `app.py`)
- Document extraction → Streamlit app: returns text (evidence: `src/extractors.py`)
- Streamlit app → Language registry: looks up language (evidence: `app.py`)
- Streamlit app → Chunked translation: requests translation (evidence: `app.py`)
- Chunked translation → Gemini API: sends chunks (evidence: `src/translator.py`)
- Gemini API → Chunked translation: returns translation (evidence: `src/translator.py`)
- Chunked translation → Runtime configuration: reads limits and models (evidence: `src/translator.py`)
- Chunked translation → Streamlit app: returns result (evidence: `app.py`)
- Streamlit app → Result state: stores results (evidence: `README.md`)
- Streamlit app → Speech synthesis: requests audio (evidence: `app.py`)
- Speech synthesis → Runtime configuration: reads chunk limit (evidence: `src/tts.py`)
- Speech synthesis → Google speech service: synthesizes speech (evidence: `src/tts.py`)
- Speech synthesis → Streamlit app: returns MP3 (evidence: `app.py`)
