File size: 1,530 Bytes
6fd136c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
## Play My Emotions API Documentation

### Overview

The Play My Emotions API provides song recommendations based on user emotions. The primary endpoint is `/recommend`, which takes in a user's emotional text and returns a list of recommended songs.

### Base URL

```
http://127.0.0.1:8000
```

### Endpoints

#### 1. POST /recommend

**Description**:  
Provides song recommendations based on the user's emotional input.

**Request**:

- **Method**: POST
- **URL**: `/recommend`
- **Headers**:
  - `Content-Type: application/json`
- **Body**:

```json
{
  "emotion_text": "string"
}
```

**Parameters**:

- `emotion_text` (required): A string containing the user's emotional state or feelings.

**Response**:

- **Status Code**: 200 OK
- **Body**:

```json
{
  "emotions": "string",
  "songs": [
    {
      "name": "string",
      "embed_url": "string"
    },
    ...
  ]
}
```

**Response Fields**:

- `emotions`: A string representing the interpreted emotions based on the user's input.
- `songs`: An array of song objects. Each object contains:
  - `name`: The name of the recommended song.
  - `embed_url`: The URL for embedding the song (e.g., a Spotify or YouTube embed link).

**Example Request**:

```json
{
  "emotion_text": "I am feeling joyful"
}
```

**Example Response**:

```json
{
  "emotions": "joyful, happy, elated",
  "songs": [
    {
      "name": "Song Name 1",
      "embed_url": "https://embed-link-1.com"
    },
    {
      "name": "Song Name 2",
      "embed_url": "https://embed-link-2.com"
    }
  ]
}