File size: 4,059 Bytes
923fcd1
 
 
 
 
 
 
 
 
9d43613
923fcd1
 
2c65563
 
2b7fedc
 
2c65563
 
 
923fcd1
 
2c65563
9d43613
2c65563
3a0ada8
1fb1a0c
9d43613
476491f
 
9d43613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
title: FamilyLegacy
emoji: πŸ“Š
colorFrom: gray
colorTo: indigo
sdk: gradio
sdk_version: 6.17.3
python_version: '3.12'
app_file: app.py
pinned: true
license: mit
short_description: AI-driven voice cloning to preserve the voices of loved ones
tags:
  - track:backyard
  - sponsor:openbmb
  - achievement:offgrid
  - achievement:offbrand
  - achievement:sharing
  - achievement:fieldnotes
---

## πŸ”— Resources & Links

- **Demo Video:** [Watch the Product Demo]([YOUR_DEMO_VIDEO_LINK_HERE](https://youtu.be/e02qP1gLHVI))
- **Blog Post:** [Read the Full Write-up](https://huggingface.co/blog/pkheria/familylegacy)
- **Linkedin Post** [Read the post](https://www.linkedin.com/posts/piyushkheria7_buildsmall-opensource-generativeai-share-7472298281763770368-En6K/)

https://huggingface.co/pkheria

## 🌟 Project Overview

**FamilyLegacy** is a compassionate AI application designed to bridge the gap between generations. By leveraging state-of-the-art voice cloning and large language models, it allows users to preserve the voices and stories of their loved ones, creating a digital legacy that can "talk back" with warmth and personality.

## ✨ Key Features

- **Voice Cloning:** Capture a short sample of a loved one's voice to create a high-fidelity digital twin using `VoxCPM2`.
- **Memory Storage:** Upload audio recordings of family stories. The system transcribes them and stores them in a vector database (`Qdrant`) for semantic retrieval.
- **Heartwarming Interactions:** Ask questions or prompt the AI to tell a story. The system retrieves relevant memories and generates a personalized response in the cloned voice.
- **Emotionally Aware:** Responses are tailored to the relationship (e.g., grandmother, father, friend) with specific tonal traits like "warm," "wise," or "cheerful."
- **Privacy Focused:** Designed to be hosted securely, ensuring your family's precious data and voices remain under your control.

## πŸ› οΈ Tech Stack

- **Backend:** [FastAPI](https://fastapi.tiangolo.com/) & [Gradio](https://gradio.app/)
- **Voice Synthesis:** [VoxCPM2](https://github.com/OpenBMB/VoxCPM)
- **Text Generation:** [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)
- **Transcription:** [OpenAI Whisper](https://github.com/openai/whisper)
- **Vector Database:** [Qdrant](https://qdrant.tech/) (for story memory retrieval)
- **Primary Database:** [MongoDB](https://www.mongodb.com/) (for voice profiles and metadata)
- **Embeddings:** `sentence-transformers/all-MiniLM-L6-v2`

## πŸ—οΈ Architecture

The application follows a modern AI pipeline:
1.  **Ingestion:** Voice samples are saved to MongoDB. Story audio is transcribed via Whisper and indexed into Qdrant.
2.  **Retrieval:** When a user asks a question, the system searches Qdrant for relevant family memories.
3.  **Generation:** An LLM (Qwen) takes the retrieved context and generates a heartwarming response.
4.  **Synthesis:** The generated text is passed to VoxCPM2 along with the reference voice profile to produce the final audio output.

## πŸš€ Getting Started

### Prerequisites

- Python 3.10+
- MongoDB instance
- Qdrant instance
- FFmpeg (for audio processing)

### Installation

1.  **Clone the repository:**
    ```bash
    git clone <repository-url>
    cd FAMILY-LEGACY
    ```

2.  **Set up a virtual environment:**
    ```bash
    python -m venv .venv
    source .venv/bin/activate  # On Windows use `.venv\Scripts\activate`
    ```

3.  **Install dependencies:**
    ```bash
    pip install -r requirements.txt
    ```

4.  **Environment Configuration:**
    Create a `.env` file in the root directory and add your connection strings (do not share these!):
    ```env
    MONGO_URL=your_mongodb_connection_string
    MONGO_DB_NAME=family_legacy
    QDRANT_URL=your_qdrant_url
    QDRANT_API_KEY=your_qdrant_api_key
    ```

### Running the App

```bash
python app.py
```
The application will be available at `http://localhost:7860`.

## πŸ“œ License

This project is licensed under the MIT License - see the header of this file for details.