# yukesh0409/celebconvoai architecture

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

- Interactive diagram: https://gitdiagram.com/yukesh0409/celebconvoai
- Repository: https://github.com/yukesh0409/celebconvoai

## Overview

##### Project Type and Purpose
- CelebConvo AI is a single-application interactive chatbot that enables users to have conversations with AI versions of celebrities.
- It uses advanced natural language processing, text embeddings, and similarity search to simulate personalities in a conversational interface.
- The project is built with Streamlit for the web interface and leverages libraries such as Transformers (Hugging Face), FAISS, LangChain, and PyTorch for processing.

##### Analyzing the File Structure
- Top-Level Files:
- .env – Contains environment variables to configure API keys and other configurations.
- CelebConvo_AI.py – The main Python file that likely orchestrates the app’s logic.
- requirements.txt – Lists all dependencies needed to run and build the environment.
- Directories:
- img – Holds images (e.g., for the UI and likely celebrity portraits).
- info – Contains text files (e.g., dhoni.txt, elon.txt, etc.) which are used to supply background personalities or style guides for each celebrity.

##### Key Components
a. User Interface (Frontend):
- A Streamlit-based web interface that handles:
- User input (text entry for questions).
- Celebrity selection (via sidebar).
- Of chat history with styled chat bubbles and images.
- Use the images in the “img” directory for UI embellishments.

b. Application Core / Backend Processing:
- Main Orchestration Module (CelebConvo_AI.py):
- Handles routing of user inputs.
- Integrates with various libraries for NLP and generation.
- Reads celebrity-specific personality guidelines from the “info” folder.
- NLP Pipeline:
- Uses Hugging Face Transformers for text embedding.
- FAISS is employed for efficient similarity search to determine contextually relevant responses.
- LangChain manages prompt templates and LLM chains.
- Google Generative AI (and PyTorch for model inference) generates the conversational responses.

c. External Services/Dependencies:
- Google Generative AI API for creating responses.
- Environment configuration managed by dotenv via the .env file.

##### Relationships and Interactions
- The UI component (Streamlit interface) takes user input and sends it to the core processing module.
- The core processing involves:
- Parsing user input.
- Reading celebrity-specific personality data.
- Performing embedding and similarity searches.
- Generating the appropriate response using the generative AI models.
- The generated reply is then passed back to the UI, which re-renders the updated conversation with appropriate visuals.

##### Architectural Patterns
- Although the project resides mostly in a single file, it mimics a separation of concerns:
- A clear UI layer (handled by Streamlit).
- A processing/service layer where NLP and ML processing are performed.
- The design leverages modular integration of libraries (via LangChain, Transformers, etc.) with a set of dynamic resources (celebrity info, embedded model outputs).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI1["User Interface (Streamlit)"]:::ui
        UI2["UI Images"]:::ui
        UI1 ---|"displays"| UI2
    end

    subgraph "Application Core"
        CORE["Main Application (CelebConvo_AI.py)"]:::core
        CONFIG["Configuration (.env)"]:::config
        DATA["Celebrity Info Data"]:::data
        DEP["Dependency Management (requirements.txt)"]:::dep
        CORE -->|"loads"| CONFIG
        CORE -->|"reads"| DATA
        CORE -->|"ensures"| DEP
    end

    subgraph "NLP & ML Processing"
        EMB["Text Embedding (Transformers)"]:::nlp
        SIM["Similarity Search (FAISS)"]:::nlp
        PROMPT["Prompt Management (LangChain)"]:::nlp
        RESP["Response Generation (GoogleGenerativeAI&PyTorch)"]:::nlp
        EMB -->|"finds"| SIM
        SIM -->|"formats"| PROMPT
        PROMPT -->|"generates"| RESP
    end

    UI1 -->|"sendsInput"| CORE
    CORE -->|"processes"| EMB
    RESP -->|"returnsResponse"| CORE
    CORE -->|"updates"| UI1

    click UI1 "https://github.com/yukesh0409/celebconvoai/blob/main/CelebConvo_AI.py"
    click UI2 "https://github.com/yukesh0409/celebconvoai/tree/main/img/"
    click CORE "https://github.com/yukesh0409/celebconvoai/blob/main/CelebConvo_AI.py"
    click DATA "https://github.com/yukesh0409/celebconvoai/tree/main/info/"
    click CONFIG "https://github.com/yukesh0409/celebconvoai/blob/main/.env"
    click DEP "https://github.com/yukesh0409/celebconvoai/blob/main/requirements.txt"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef core fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef config fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef nlp fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef dep fill:#EEE8AA,stroke:#000,stroke-width:2px;
```
