# aiwithhassan/deploy-with-docker architecture

> Architecture diagram of the GitHub repository aiwithhassan/deploy-with-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aiwithhassan/deploy-with-docker
- Repository: https://github.com/aiwithhassan/deploy-with-docker

## Overview

##### Project type and purpose
- This is a Python-based interactive AI audio application with a lightweight UI (Gradio).
- It implements a multi-phase conversational pipeline: capture patient voice → convert to text → generate doctor reply → synthesize doctor voice.
- The project can be run locally or containerized (Dockerfile present).

##### File structure
- Top-level Python scripts:
- brain_of_the_doctor.py – calls the LLM or rule engine to generate text replies
- voice_of_the_patient.py – captures/ingests mic input and runs speech-to-text
- voice_of_the_doctor.py – runs text-to-speech (gTTS/ElevenLabs)
- gradio_app.py – front-end server tying all phases into a web UI
- Configuration files:
- Dockerfile – container build instructions
- Pipfile / requirements.txt – Python dependencies
- Static assets:
- Various .mp3 files for testing TTS/ASR
- No separate “frontend” directory: UI lives in gradio_app.py

##### README for additional insights
- Lists external dependencies: FFmpeg, PortAudio – needed for audio I/O
- Describes four “phases” corresponding to the scripts above
- Shows both pipenv and pip/venv or conda install options

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External user
    subgraph "External User"
        User["User"]:::ext
    end

    %% Container boundary
    subgraph "Docker Container" 
        direction TB
        GradioUI["Gradio Front-End Server"]:::ui
        ASR["ASR Component"]:::proc
        Brain["NLU / Brain Component"]:::proc
        TTS["TTS Component"]:::proc
    end

    %% External services
    FFmpeg["FFmpeg"]:::ext
    PortAudio["PortAudio"]:::ext

    %% Data flow
    User -->|"speaks (audio stream)"| GradioUI
    GradioUI -->|".wav stream"| ASR
    ASR -->|"text (UTF-8)"| Brain
    Brain -->|"reply text"| TTS
    TTS -->|".mp3 audio"| GradioUI
    GradioUI -->|"plays audio"| User

    %% ASR dependencies
    ASR --> FFmpeg
    ASR --> PortAudio

    %% Side: configuration files
    subgraph "Configuration & Deployment"
        direction TB
        Dockerfile["Dockerfile"]:::config
        Pipfile["Pipfile"]:::config
        PipfileLock["Pipfile.lock"]:::config
        ReqTxt["requirements.txt"]:::config
        README["README.md"]:::config
        DeployDoc["Deploy GenAI App with Docker.pdf"]:::config
    end

    %% Side: static assets
    subgraph "Static Audio Assets"
        direction TB
        A1["elevenlabs_testing.mp3"]:::asset
        A2["elevenlabs_testing_autoplay.mp3"]:::asset
        A3["gtts_testing.mp3"]:::asset
        A4["gtts_testing_autoplay.mp3"]:::asset
        A5["patient_voice_test.mp3"]:::asset
        A6["patient_voice_test_for_patient.mp3"]:::asset
    end

    %% Click events
    click GradioUI "https://github.com/aiwithhassan/deploy-with-docker/blob/main/gradio_app.py"
    click ASR "https://github.com/aiwithhassan/deploy-with-docker/blob/main/voice_of_the_patient.py"
    click Brain "https://github.com/aiwithhassan/deploy-with-docker/blob/main/brain_of_the_doctor.py"
    click TTS "https://github.com/aiwithhassan/deploy-with-docker/blob/main/voice_of_the_doctor.py"
    click Dockerfile "https://github.com/aiwithhassan/deploy-with-docker/tree/main/Dockerfile"
    click Pipfile "https://github.com/aiwithhassan/deploy-with-docker/tree/main/Pipfile"
    click PipfileLock "https://github.com/aiwithhassan/deploy-with-docker/blob/main/Pipfile.lock"
    click ReqTxt "https://github.com/aiwithhassan/deploy-with-docker/blob/main/requirements.txt"
    click README "https://github.com/aiwithhassan/deploy-with-docker/blob/main/README.md"
    click DeployDoc "https://github.com/aiwithhassan/deploy-with-docker/blob/main/Deploy GenAI App with Docker.pdf"
    click A1 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/elevenlabs_testing.mp3"
    click A2 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/elevenlabs_testing_autoplay.mp3"
    click A3 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/gtts_testing.mp3"
    click A4 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/gtts_testing_autoplay.mp3"
    click A5 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/patient_voice_test.mp3"
    click A6 "https://github.com/aiwithhassan/deploy-with-docker/blob/main/patient_voice_test_for_patient.mp3"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085;
    classDef proc fill:#d4edda,stroke:#155724,color:#155724;
    classDef ext fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef config fill:#fff3cd,stroke:#856404,color:#856404;
    classDef asset fill:#f8d7da,stroke:#721c24,color:#721c24;
```
