Ubuntu commited on
Commit ·
61704f2
1
Parent(s): 8c9a0f8
workign 2 dbs need toe be in server 1
Browse files
README.md
CHANGED
|
@@ -1,120 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
- **Contexts** - Track listening contexts (weather, time, location)
|
| 12 |
-
- **Play History** - Log listening history
|
| 13 |
-
- **Semantic Search** - Search songs, memories, and playlists by vibe/mood using AI embeddings
|
| 14 |
-
|
| 15 |
-
## Tech Stack
|
| 16 |
-
|
| 17 |
-
- **FastAPI** - REST API
|
| 18 |
-
- **SQLite** - Permanent storage for all data
|
| 19 |
-
- **ChromaDB** - Semantic search embeddings
|
| 20 |
-
- **Sentence Transformers** - all-MiniLM-L6-v2 for embeddings
|
| 21 |
-
- **Gradio** - Web UI
|
| 22 |
-
|
| 23 |
-
## API Endpoints
|
| 24 |
-
|
| 25 |
-
### Songs
|
| 26 |
-
| Method | Endpoint | Description |
|
| 27 |
-
|--------|----------|-------------|
|
| 28 |
-
| GET | `/songs` | List all songs |
|
| 29 |
-
| GET | `/songs/{id}` | Get song by ID |
|
| 30 |
-
| POST | `/songs?title=X&artist=Y&lyrics=Z` | Add song |
|
| 31 |
-
| DELETE | `/songs/{id}` | Delete song |
|
| 32 |
-
|
| 33 |
-
### Users
|
| 34 |
-
| Method | Endpoint | Description |
|
| 35 |
-
|--------|----------|-------------|
|
| 36 |
-
| GET | `/users` | List all users |
|
| 37 |
-
| GET | `/users/{id}` | Get user by ID |
|
| 38 |
-
| POST | `/users?name=X` | Add user |
|
| 39 |
-
|
| 40 |
-
### Memories
|
| 41 |
-
| Method | Endpoint | Description |
|
| 42 |
-
|--------|----------|-------------|
|
| 43 |
-
| GET | `/memories` | List all memories |
|
| 44 |
-
| GET | `/users/{id}/memories` | Get user's memories |
|
| 45 |
-
| POST | `/memories?user_id=X&description=Y` | Add memory |
|
| 46 |
-
| DELETE | `/memories/{id}` | Delete memory |
|
| 47 |
-
|
| 48 |
-
### Playlists
|
| 49 |
-
| Method | Endpoint | Description |
|
| 50 |
-
|--------|----------|-------------|
|
| 51 |
-
| GET | `/playlists` | List all playlists |
|
| 52 |
-
| POST | `/playlists?name=X&mood_description=Y` | Add playlist |
|
| 53 |
-
| DELETE | `/playlists/{id}` | Delete playlist |
|
| 54 |
-
|
| 55 |
-
### Contexts
|
| 56 |
-
| Method | Endpoint | Description |
|
| 57 |
-
|--------|----------|-------------|
|
| 58 |
-
| GET | `/contexts` | List all contexts |
|
| 59 |
-
| POST | `/contexts?weather=X&time_of_day=Y` | Add context |
|
| 60 |
-
| DELETE | `/contexts/{id}` | Delete context |
|
| 61 |
-
|
| 62 |
-
### Play History
|
| 63 |
-
| Method | Endpoint | Description |
|
| 64 |
-
|--------|----------|-------------|
|
| 65 |
-
| GET | `/history?user_id=X` | Get play history |
|
| 66 |
-
| POST | `/history?user_id=X&song_id=Y` | Add play entry |
|
| 67 |
-
|
| 68 |
-
### Semantic Search
|
| 69 |
-
| Method | Endpoint | Description |
|
| 70 |
-
|--------|----------|-------------|
|
| 71 |
-
| GET | `/search/songs?q=query&n=5` | Search songs by vibe |
|
| 72 |
-
| GET | `/search/memories?q=query&n=5` | Search memories |
|
| 73 |
-
| GET | `/search/playlists?q=query&n=5` | Search playlists by mood |
|
| 74 |
-
| GET | `/search/contexts?q=query&n=5` | Search contexts |
|
| 75 |
-
|
| 76 |
-
## Example Usage
|
| 77 |
-
|
| 78 |
-
```bash
|
| 79 |
-
# Add a user
|
| 80 |
-
curl -X POST "http://localhost:7860/users?name=Alice"
|
| 81 |
-
|
| 82 |
-
# Add a song with lyrics for semantic search
|
| 83 |
-
curl -X POST "http://localhost:7860/songs?title=Midnight%20Rain&artist=Taylor%20Swift&energy_level=6&lyrics=He%20wanted%20it%20comfortable%20quiet%20life"
|
| 84 |
-
|
| 85 |
-
# Add a memory
|
| 86 |
-
curl -X POST "http://localhost:7860/memories?user_id=1&description=Dancing in the rain on our first date&song_id=1"
|
| 87 |
-
|
| 88 |
-
# Search songs by vibe
|
| 89 |
-
curl "http://localhost:7860/search/songs?q=sad%20breakup&n=5"
|
| 90 |
-
|
| 91 |
-
# Search memories
|
| 92 |
-
curl "http://localhost:7860/search/memories?q=romantic%20evening&n=5"
|
| 93 |
-
|
| 94 |
-
# Search playlists by mood
|
| 95 |
-
curl "http://localhost:7860/search/playlists?q=chill%20evening%20vibes&n=5"
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
## Run Locally
|
| 99 |
-
|
| 100 |
-
```bash
|
| 101 |
-
# Install dependencies
|
| 102 |
-
uv sync
|
| 103 |
-
|
| 104 |
-
# Run the server
|
| 105 |
-
uvicorn main:app --host 0.0.0.0 --port 7860
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
Visit `http://localhost:7860/ui` for the web interface.
|
| 109 |
-
|
| 110 |
-
## Docker
|
| 111 |
-
|
| 112 |
-
```bash
|
| 113 |
-
docker build -t music-memories .
|
| 114 |
-
docker run -p 7860:7860 -v ./data:/app/data music-memories
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
## Data Storage
|
| 118 |
-
|
| 119 |
-
- **SQLite**: `music_memories.db` - All structured data
|
| 120 |
-
- **ChromaDB**: `chroma_db/` - Semantic search embeddings
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Pool
|
| 3 |
+
emoji: 🌍
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|