File size: 2,473 Bytes
290f5b2
 
2b9bb06
290f5b2
 
 
 
 
 
 
 
 
2b9bb06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538f141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2b9bb06
 
 
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
---
title: TaylorSwiftDJ
emoji: 🌟
colorFrom: pink
colorTo: indigo
sdk: streamlit
sdk_version: 1.26.0
app_file: app.py
pinned: false
license: creativeml-openrail-m
---

# TaylorSwiftDJ 🌟

*<small>Made with [DeepLake](https://www.deeplake.ai/) πŸš€ and [LangChain](https://python.langchain.com/en/latest/index.html) πŸ¦œβ›“οΈ</small>*

πŸ’« Hey there Swifties! Welcome to "TaylorSwiftDJ"! 🎀🎢 \
This streamlit powered app recommends Taylor Swift's iconic songs 'tailored'(hah! :D) to your emotions. \
Dance, reminisce, and embrace your feelings with every beat – because life's a melody, and Taylor's your DJ. ✨ 🌈 πŸ’–

  
## How it works
The application follows a sequence of steps to deliver Taylor Swift songs matching the user's emotions:
- **User Input**: The application starts by collecting user's emotional state through a text input.
- **Emotion Encoding**: The user-provided emotions are then fed to a Language Model (LLM). The LLM interprets and encodes these emotions.
- **Similarity Search**: These encoded emotions are utilized to perform a similarity search within our [vector database](https://www.deeplake.ai/). This database houses ~130 Taylor Swift songs, each represented as emotional embeddings.
- **Song Selection**: From the pool of top matching songs, the application randomly selects one. The selection is weighted, giving preference to songs with higher similarity scores.
- **Song Retrieval**: The selected song's embedded player is displayed on the webpage for the user. Additionally, the LLM interpreted emotional state associated with the chosen song is displayed.

## Setup instructions

### Checkout the repo
Clone the repository using the following command:
```
git clone https://huggingface.co/spaces/mchockal/TaylorSwiftDJ
```

### Set Environment Variables
You'll need to set the following variables in the `env_vars.env` file:

```dotenv
OPENAI_API_KEY=
ACTIVELOOP_TOKEN=
ACTIVELOOP_ORG_ID=
MODEL = "text-embedding-ada-002"
DATASET = <your_vector_space_for_emotions>
UPSTASH_URL= 
UPSTASH_PASSWORD=
USE_STORAGE="False"
ROOT=
```

### Install Dependencies
Install the required dependencies using the following command:
```
pip install -r requirements.txt
```

### Run the Streamlit App
Launch the Streamlit app using the following command:
```
streamlit run app.py
```
<small>_DISCLAIMER_: This project is 200% inspired by Francesco's [FairyTaleDJ](https://github.com/FrancescoSaverioZuppichini/FairytaleDJ). </small>