# yago-145/versevisions architecture

> Architecture diagram of the GitHub repository yago-145/versevisions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yago-145/versevisions
- Repository: https://github.com/yago-145/versevisions

## Overview

##### Main Components
- User Interface (UI) Layer: Represented by the Streamlit app(s) such as src/app_v3.py (the main entry point per README). This is the front-facing component where users upload audio files and select styles.
- Audio Processing Modules: These include scripts like src/transcribe_audio.py, src/split_audio.py, and src/whisperx_detect.py. They handle tasks such as audio segmentation, transcription, and possibly voice detection.
- Text and Prompt Generation: Containing modules such as src/get_lyrics.py, src/extract_sentiments.py, src/generate_prompt.py, src/auto_prompt.py, src/langchain_prompts.py, and src/langchain_FAISS.py. This group processes transcribed text, extracts metadata (like sentiment), and generates creative prompts.
- Image and Animation Generation: Modules like src/generate_imgs.py, src/generate_sd_prompts.py, src/generate_streamlit_imgs.py, and src/create_animation.py deal with image creation (likely using Stable Diffusion) and animation construction.
- Video Assembly and Playback: Modules such as src/generate_video.py, src/add_music_text.py, and src/play_song.py assemble the final video, overlay audio/music, and potentially add text overlays.

##### Data Stores and Supporting Artifacts
- Data Input: The “data” directory holds training files (CSV, PARQUET) which might be used to train or fine-tune underlying models or verify input consistency.
- Notebooks for Experimentation: The “notebooks_dev” folder holds several Jupyter notebooks for prototyping prompts, stable diffusion experiments (including image and video tests), and testing integration with language chain components.

##### Interactions and Data Flow
- Next, an audio processing pipeline is triggered that splits the audio and transcribes it.
- The transcribed text is then passed to the text and prompt generation modules that produce creative prompts (and possibly extract lyrics and sentiments).
- The prompts are fed to the image generation modules which call to external services (or local machine learning models) like Stable Diffusion to create visuals.
- Finally, the image sequences are combined with the audio to generate a complete animated videoclip.

##### Architectural Patterns and Technologies
- Layered Architecture: Divide the system into presentation (UI), processing (audio/text/image pipelines), and orchestration (video assembly).
- Modular Design: Each task (audio processing, text analysis, image generation, video creation) is encapsulated in individual Python scripts which interact in a pipeline.
- Use of External Libraries/Services: Note the probable integration with Stable Diffusion for image generation and language processing tools (indicated by langchain modules). Represent these as external systems where appropriate.
- Environment/Deployment: The README emphasizes using an Anaconda environment, so include a note on configuring the runtime environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["Streamlit UI"]:::ui
    end

    %% Audio Processing Pipeline
    subgraph "Audio Processing Pipeline"
        SPLIT["Audio Splitting (src/split_audio.py)"]:::audio
        TRANS["Transcription (src/transcribe_audio.py)"]:::audio
        DETECT["Voice Detection (src/whisperx_detect.py)"]:::audio
    end

    %% Text & Prompt Generation
    subgraph "Text & Prompt Generation"
        LYRICS["Lyrics Extraction (src/get_lyrics.py)"]:::text
        SENTI["Sentiment Analysis (src/extract_sentiments.py)"]:::text
        PROMPT1["Generate Prompt (src/generate_prompt.py)"]:::text
        PROMPT2["Auto Prompt (src/auto_prompt.py)"]:::text
        LC1["LangChain Prompts (src/langchain_prompts.py)"]:::text
        LC2["LangChain FAISS (src/langchain_FAISS.py)"]:::text
    end

    %% Image Creation and Animation Generation
    subgraph "Image & Animation Generation"
        subgraph "Image Creation"
            IMG1["Stable Diffusion Base (src/generate_imgs.py)"]:::image
            IMG2["SD Prompt Support (src/generate_sd_prompts.py)"]:::image
            IMG3["Streamlit Image Gen (src/generate_streamlit_imgs.py)"]:::image
        end
        ANIM["Animation Assembly (src/create_animation.py)"]:::image
    end

    %% Video Assembly and Playback
    subgraph "Video Assembly and Playback"
        VIDEO["Video Generation (src/generate_video.py)"]:::video
        OVERLAY["Audio/Text Overlay (src/add_music_text.py)"]:::video
        PLAY["Playback (src/play_song.py)"]:::video
    end

    %% Supporting Data and Experimentation
    subgraph "Supporting Components"
        DATA["Data Inputs (data)"]:::data
        NOTEBOOK["Experimentation/Prototyping (notebooks_dev)"]:::notebooks
    end

    %% Data Flow
    UI --> SPLIT
    SPLIT --> TRANS
    TRANS --> DETECT

    DETECT --> LYRICS
    DETECT --> SENTI
    DETECT --> PROMPT1
    DETECT --> PROMPT2

    PROMPT1 --> LC1
    PROMPT2 --> LC2

    LC1 --> IMG1
    LC2 --> IMG1
    LYRICS --> IMG1
    SENTI --> IMG1
    PROMPT1 --> IMG1
    PROMPT2 --> IMG1

    IMG1 --> ANIM
    IMG2 --> ANIM
    IMG3 --> ANIM

    ANIM --> VIDEO
    VIDEO --> OVERLAY
    OVERLAY --> PLAY

    DATA -.-> LYRICS
    DATA -.-> SENTI
    DATA -.-> PROMPT1
    DATA -.-> PROMPT2
    DATA -.-> LC1
    DATA -.-> LC2

    NOTEBOOK -.-> LC1
    NOTEBOOK -.-> LC2

    %% Click Events
    click UI "https://github.com/yago-145/versevisions/blob/main/src/app_v3.py"
    click SPLIT "https://github.com/yago-145/versevisions/blob/main/src/split_audio.py"
    click TRANS "https://github.com/yago-145/versevisions/blob/main/src/transcribe_audio.py"
    click DETECT "https://github.com/yago-145/versevisions/blob/main/src/whisperx_detect.py"
    click LYRICS "https://github.com/yago-145/versevisions/blob/main/src/get_lyrics.py"
    click SENTI "https://github.com/yago-145/versevisions/blob/main/src/extract_sentiments.py"
    click PROMPT1 "https://github.com/yago-145/versevisions/blob/main/src/generate_prompt.py"
    click PROMPT2 "https://github.com/yago-145/versevisions/blob/main/src/auto_prompt.py"
    click LC1 "https://github.com/yago-145/versevisions/blob/main/src/langchain_prompts.py"
    click LC2 "https://github.com/yago-145/versevisions/blob/main/src/langchain_FAISS.py"
    click IMG1 "https://github.com/yago-145/versevisions/blob/main/src/generate_imgs.py"
    click IMG2 "https://github.com/yago-145/versevisions/blob/main/src/generate_sd_prompts.py"
    click IMG3 "https://github.com/yago-145/versevisions/blob/main/src/generate_streamlit_imgs.py"
    click ANIM "https://github.com/yago-145/versevisions/blob/main/src/create_animation.py"
    click VIDEO "https://github.com/yago-145/versevisions/blob/main/src/generate_video.py"
    click OVERLAY "https://github.com/yago-145/versevisions/blob/main/src/add_music_text.py"
    click PLAY "https://github.com/yago-145/versevisions/blob/main/src/play_song.py"
    click DATA "https://github.com/yago-145/versevisions/tree/main/data"
    click NOTEBOOK "https://github.com/yago-145/versevisions/tree/main/notebooks_dev"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef audio fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef text fill:#FFFFE0,stroke:#000,stroke-width:1px;
    classDef image fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef video fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef data fill:#E0FFFF,stroke:#000,stroke-width:1px;
    classDef notebooks fill:#E6E6FA,stroke:#000,stroke-width:1px;
```
