Francesco commited on
Commit
ccabaa8
1 Parent(s): db2d292

first version of prompt with emotions

Browse files
app.py CHANGED
@@ -7,7 +7,7 @@ from langchain.prompts import PromptTemplate
7
 
8
  load_dotenv()
9
  import os
10
-
11
  from langchain.chat_models import ChatOpenAI
12
  from langchain.embeddings.openai import OpenAIEmbeddings
13
 
@@ -29,17 +29,30 @@ def init():
29
  )
30
 
31
  prompt = PromptTemplate(
32
- input_variables=["content"],
33
- template=Path("prompts/bot.prompt").read_text(),
34
- )
35
 
36
  llm = ChatOpenAI(temperature=0.7)
37
 
38
  chain = LLMChain(llm=llm, prompt=prompt)
39
 
40
- return db, chain
 
 
 
 
 
41
 
42
- db, chain = init()
 
 
 
 
 
 
 
 
43
 
44
  st.title("Disney song for you")
45
 
@@ -52,20 +65,14 @@ clicked = st.button("Click me")
52
  placeholder_emotions = st.empty()
53
  placeholder = st.empty()
54
 
55
- def get_emotions(user_input):
56
- emotions = chain.run(content=user_input)
57
- print(f"Emotions: {emotions}")
58
- matches = db.similarity_search_with_score(emotions, distance_metric="cos")
59
- print(matches)
60
- doc, score = matches[0]
61
- iframes_html = ""
62
- with placeholder_emotions:
63
- st.write(emotions)
64
  with placeholder:
65
- embed_url = doc.metadata["embed_url"]
66
  iframe_html = f'<iframe src="{embed_url}" style="border:0"> </iframe>'
67
  st.components.v1.html(f"<div style='display:flex;flex-direction:column'>{iframe_html}</div>")
68
 
69
-
70
  if clicked:
71
- get_emotions(text_input)
 
7
 
8
  load_dotenv()
9
  import os
10
+ import json
11
  from langchain.chat_models import ChatOpenAI
12
  from langchain.embeddings.openai import OpenAIEmbeddings
13
 
 
29
  )
30
 
31
  prompt = PromptTemplate(
32
+ input_variables=["songs", "user_input"],
33
+ template=Path("prompts/bot_with_summary.prompt").read_text(),
34
+ )
35
 
36
  llm = ChatOpenAI(temperature=0.7)
37
 
38
  chain = LLMChain(llm=llm, prompt=prompt)
39
 
40
+ with open("data/emotions_with_spotify_url.json", "r") as f:
41
+ data = json.load(f)
42
+
43
+ movies_and_names_to_songs = {}
44
+
45
+ songs_str = ""
46
 
47
+ for movie, songs in data.items():
48
+ for song in songs:
49
+ movie_and_name = f"{movie};{song['name'].lower()}"
50
+ songs_str += f"{movie_and_name}:{song['text']}\n"
51
+ movies_and_names_to_songs[movie_and_name] = song
52
+
53
+ return db, chain, movies_and_names_to_songs, songs_str
54
+
55
+ db, chain, movies_and_names_to_songs, songs_str = init()
56
 
57
  st.title("Disney song for you")
58
 
 
65
  placeholder_emotions = st.empty()
66
  placeholder = st.empty()
67
 
68
+ def get_emotions(songs_str, user_input):
69
+ key = chain.run(songs=songs_str, user_input=user_input)
70
+ doc = movies_and_names_to_songs[key]
71
+ print(f"Reply: {key}")
 
 
 
 
 
72
  with placeholder:
73
+ embed_url = doc["embed_url"]
74
  iframe_html = f'<iframe src="{embed_url}" style="border:0"> </iframe>'
75
  st.components.v1.html(f"<div style='display:flex;flex-direction:column'>{iframe_html}</div>")
76
 
 
77
  if clicked:
78
+ get_emotions(songs_str, text_input)
data/emotions_with_spotify_url.json ADDED
@@ -0,0 +1,495 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Aladdin": [
3
+ {
4
+ "name": "Friend Like Me",
5
+ "text": "excitement, happiness, humor, friendliness, generosity, willingness, eagerness, confidence",
6
+ "embed_url": "https://open.spotify.com/embed/track/5f2TWu6R2YYCJtLQ0fP78H?utm_source=generator"
7
+ },
8
+ {
9
+ "name": "Arabian Nights",
10
+ "text": "nostalgic, adventurous, exotic, intense, romantic, mysterious, whimsical, passionate",
11
+ "embed_url": "https://open.spotify.com/embed/track/0CKmN3Wwk8W4zjU0pqq2cv?utm_source=generator"
12
+ },
13
+ {
14
+ "name": "A Whole New World",
15
+ "text": "wonder, joy, excitement, adventure, romance, freedom, happiness, awe",
16
+ "embed_url": "https://open.spotify.com/embed/track/1hwdPQtFHISvZ9SXMkNrIK?utm_source=generator"
17
+ },
18
+ {
19
+ "name": "One Jump Ahead",
20
+ "text": "Thrill, fear, desperation, humor, defiance, friendship, hunger, rebellion.",
21
+ "embed_url": "https://open.spotify.com/embed/track/4wN8Ov3kPZdkJ8XcYxYUGz?utm_source=generator"
22
+ }
23
+ ],
24
+ "Aladdin (live-action)": [
25
+ {
26
+ "name": "A Whole New World",
27
+ "text": "nostalgia, wonder, excitement, joy, romance, adventure, hope, inspiration",
28
+ "embed_url": "https://open.spotify.com/embed/track/1hwdPQtFHISvZ9SXMkNrIK?utm_source=generator"
29
+ },
30
+ {
31
+ "name": "A Whole New World (End Title)",
32
+ "text": "joy, wonder, excitement, adventure, love, freedom, exhilaration, enchantment",
33
+ "embed_url": "https://open.spotify.com/embed/track/4U9CF27YlwHRtUGKUzhUTT?utm_source=generator"
34
+ },
35
+ {
36
+ "name": "Friend Like Me",
37
+ "text": "excitement, confidence, generosity, humor, friendliness, helpfulness, empowerment, joyfulness",
38
+ "embed_url": "https://open.spotify.com/embed/track/5f2TWu6R2YYCJtLQ0fP78H?utm_source=generator"
39
+ },
40
+ {
41
+ "name": "One Jump Ahead",
42
+ "text": "excitement, fear, desperation, humor, defiance, loneliness, camaraderie, determination",
43
+ "embed_url": "https://open.spotify.com/embed/track/4wN8Ov3kPZdkJ8XcYxYUGz?utm_source=generator"
44
+ },
45
+ {
46
+ "name": "Speechless (Full)",
47
+ "text": "determination, empowerment, resilience, strength, defiance, courage, passion, perseverance",
48
+ "embed_url": "https://open.spotify.com/embed/track/0XPsOSYzDJZJArevQNm2AR?utm_source=generator"
49
+ }
50
+ ],
51
+ "Aladdin: The Return of Jafar": [
52
+ {
53
+ "name": "Arabian Nights",
54
+ "text": "excitement, wonder, adventure, awe, joy, fascination, thrill, curiosity",
55
+ "embed_url": "https://open.spotify.com/embed/track/0CKmN3Wwk8W4zjU0pqq2cv?utm_source=generator"
56
+ }
57
+ ],
58
+ "Beauty and the Beast": [
59
+ {
60
+ "name": "Belle",
61
+ "text": "calm, content, curious, dreamy, happy, hopeful, romantic, whimsical",
62
+ "embed_url": "https://open.spotify.com/embed/track/1cPfKp9ThNZ1fez9itmUMN?utm_source=generator"
63
+ },
64
+ {
65
+ "name": "Be Our Guest",
66
+ "text": "joy, excitement, hospitality, gratitude, entertainment, nostalgia, comfort, satisfaction",
67
+ "embed_url": "https://open.spotify.com/embed/track/2F8LPJgSVTJxukoParTyBD?utm_source=generator"
68
+ }
69
+ ],
70
+ "Brave": [
71
+ {
72
+ "name": "Touch the Sky",
73
+ "text": "hopeful, adventurous, determined, inspired, free-spirited, empowered, awe-struck, exhilarated",
74
+ "embed_url": "https://open.spotify.com/embed/track/5yyqx4brn6Bm9U1Rj9ENnz?utm_source=generator"
75
+ }
76
+ ],
77
+ "Coco": [
78
+ {
79
+ "name": "Remember Me (D\u00fao)",
80
+ "text": "nostalgia, love, longing, sadness, hope, comfort, devotion, perseverance",
81
+ "embed_url": "https://open.spotify.com/embed/track/3pCgIUkmRHKydu9HE03QKY?utm_source=generator"
82
+ },
83
+ {
84
+ "name": "Remember Me (Ernesto de la Cruz)",
85
+ "text": "longing, separation, love, devotion, sadness, comfort, hope, reminiscence",
86
+ "embed_url": "https://open.spotify.com/embed/track/4ljlAxfaEjO4Q4g9FMtVj4?utm_source=generator"
87
+ },
88
+ {
89
+ "name": "The World Es Mi Familia",
90
+ "text": "joy, happiness, excitement, love, gratitude, belonging, unity, celebration",
91
+ "embed_url": "https://open.spotify.com/embed/track/7FOS31xq9jv4cXWtp6Jnzw?utm_source=generator"
92
+ },
93
+ {
94
+ "name": "Un Poco Loco",
95
+ "text": "confusion, love, amusement, uncertainty, joy, surprise, frustration, whimsy",
96
+ "embed_url": "https://open.spotify.com/embed/track/0OFknyqxmSQ42SoKxWVTok?utm_source=generator"
97
+ }
98
+ ],
99
+ "Descendants 3": [
100
+ {
101
+ "name": "Dig a Little Deeper",
102
+ "text": "Hope, Acceptance, Empowerment, Encouragement, Determination, Inspiration, Resilience, Confidence.",
103
+ "embed_url": "https://open.spotify.com/embed/track/7kh64k3P9Fk4EsA6vOdwmj?utm_source=generator"
104
+ }
105
+ ],
106
+ "Encanto": [
107
+ {
108
+ "name": "The Family Madrigal",
109
+ "text": "joy, excitement, wonder, confusion, love, pride, nostalgia, humor",
110
+ "embed_url": "https://open.spotify.com/embed/track/4b1yxSdlumA8N4fEk4UOZp?utm_source=generator"
111
+ },
112
+ {
113
+ "name": "Surface Pressure",
114
+ "text": "strength, confidence, anxiety, pressure, worry, fear, determination, resilience",
115
+ "embed_url": "https://open.spotify.com/embed/track/760jhRscwGbIIe1m1IIQpU?utm_source=generator"
116
+ },
117
+ {
118
+ "name": "Two Oruguitas",
119
+ "text": "love, yearning, hunger, fear, anticipation, change, trust, growth",
120
+ "embed_url": "https://open.spotify.com/embed/track/6jPVyjPqp2BNUJnDSwm8tK?utm_source=generator"
121
+ },
122
+ {
123
+ "name": "We Don't Talk About Bruno",
124
+ "text": "joy, fear, confusion, anxiety, frustration, curiosity, anger, humor",
125
+ "embed_url": "https://open.spotify.com/embed/track/52xJxFP6TqMuO4Yt0eOkMz?utm_source=generator"
126
+ },
127
+ {
128
+ "name": "What Else Can I Do?",
129
+ "text": "unexpected, beautiful, practiced, carnivorous, new, sick of pretty, rising, changing minds",
130
+ "embed_url": "https://open.spotify.com/embed/track/3XoYqtiWHhsk59frZupImG?utm_source=generator"
131
+ },
132
+ {
133
+ "name": "Waiting on a Miracle",
134
+ "text": "upset, mad, regret, sad, fine, longing, hopeful, impatient",
135
+ "embed_url": "https://open.spotify.com/embed/track/3oRW9ZGPRbLRMneQ5lwflt?utm_source=generator"
136
+ }
137
+ ],
138
+ "Enchanted": [
139
+ {
140
+ "name": "Happy Working Song",
141
+ "text": "joy, cheerfulness, contentment, enthusiasm, satisfaction, excitement, pleasure, happiness",
142
+ "embed_url": "https://open.spotify.com/embed/track/7G061Oqw7NXFr1NDTpXoI4?utm_source=generator"
143
+ },
144
+ {
145
+ "name": "So Close",
146
+ "text": "romantic, hopeful, longing, joy, fear, sadness, content, nostalgia",
147
+ "embed_url": "https://open.spotify.com/embed/track/3XFkhxO5jo2hBOWNzIQ9UB?utm_source=generator"
148
+ },
149
+ {
150
+ "name": "That's How You Know",
151
+ "text": "love, happiness, affection, devotion, passion, adoration, appreciation, romance",
152
+ "embed_url": "https://open.spotify.com/embed/track/1OzSfjFW08DTD51XoNnog7?utm_source=generator"
153
+ }
154
+ ],
155
+ "Frozen": [
156
+ {
157
+ "name": "Do You Want to Build a Snowman?",
158
+ "text": "loneliness, longing, sadness, nostalgia, hope, perseverance, friendship, playfulness",
159
+ "embed_url": "https://open.spotify.com/embed/track/2yi7HZrBOC4bMUSTcs4VK6?utm_source=generator"
160
+ },
161
+ {
162
+ "name": "For the First Time in Forever",
163
+ "text": "excited, hopeful, nervous, happy, anxious, optimistic, romantic, determined",
164
+ "embed_url": "https://open.spotify.com/embed/track/70b5Sq3ePOu3Gqg0hjlOtR?utm_source=generator"
165
+ },
166
+ {
167
+ "name": "In Summer",
168
+ "text": "joy, anticipation, excitement, happiness, nostalgia, humor, contentment, playfulness",
169
+ "embed_url": "https://open.spotify.com/embed/track/7bG6SQBGZthPDG5QJL5Gf7?utm_source=generator"
170
+ },
171
+ {
172
+ "name": "Let it Go",
173
+ "text": "isolation, determination, freedom, empowerment, resilience, confidence, defiance, happiness",
174
+ "embed_url": "https://open.spotify.com/embed/track/0qcr5FMsEO85NAQjrlDRKo?utm_source=generator"
175
+ },
176
+ {
177
+ "name": "Love is an Open Door",
178
+ "text": "joy, excitement, love, happiness, contentment, connection, optimism, anticipation",
179
+ "embed_url": "https://open.spotify.com/embed/track/68jg6wseZjKSJ0HUMjNS7C?utm_source=generator"
180
+ }
181
+ ],
182
+ "Frozen 2": [
183
+ {
184
+ "name": "All Is Found",
185
+ "text": "nostalgia, safety, discovery, fear, magic, bravery, loss, hope.",
186
+ "embed_url": "https://open.spotify.com/embed/track/5EeQQ8BVJTRkp1AIKJILGY?utm_source=generator"
187
+ },
188
+ {
189
+ "name": "Into the Unknown",
190
+ "text": "confusion, fear, hesitation, loneliness, longing, uncertainty, curiosity, determination",
191
+ "embed_url": "https://open.spotify.com/embed/track/421eObjg0DTm2qajJl5OJm?utm_source=generator"
192
+ },
193
+ {
194
+ "name": "Lost in the Woods",
195
+ "text": "wondering, lost, confused, sad, longing, hopeful, uncertain, anxious",
196
+ "embed_url": "https://open.spotify.com/embed/track/7namdlOhbtsc8FvoSafOQt?utm_source=generator"
197
+ },
198
+ {
199
+ "name": "Show Yourself",
200
+ "text": "trembling, familiar, sense of belonging, longing, certainty, purpose, anticipation, empowerment",
201
+ "embed_url": "https://open.spotify.com/embed/track/50WeOnXhM1H7AZEeIDoWfZ?utm_source=generator"
202
+ },
203
+ {
204
+ "name": "Some Things Never Change",
205
+ "text": "nostalgia, love, uncertainty, hope, contentment, joy, apprehension, gratitude",
206
+ "embed_url": "https://open.spotify.com/embed/track/4Xbotg4PCLJw9cDx2dtZLK?utm_source=generator"
207
+ },
208
+ {
209
+ "name": "When I Am Older",
210
+ "text": "nostalgia, comfort, curiosity, fear, acceptance, wisdom, optimism, reassurance",
211
+ "embed_url": "https://open.spotify.com/embed/track/1Tt7zr1yDbKbT8L4jzSZ74?utm_source=generator"
212
+ }
213
+ ],
214
+ "Hercules": [
215
+ {
216
+ "name": "A Star Is Born",
217
+ "text": "excitement, triumph, hope, inspiration, admiration, joy, pride, determination",
218
+ "embed_url": "https://open.spotify.com/embed/track/64Eug7tFE4KWJNQUE73BGe?utm_source=generator"
219
+ },
220
+ {
221
+ "name": "Go the Distance",
222
+ "text": "Hopeful, determined, inspired, optimistic, longing, driven, passionate, adventurous.",
223
+ "embed_url": "https://open.spotify.com/embed/track/0D1OY0M5A0qD5HGBvFmFid?utm_source=generator"
224
+ },
225
+ {
226
+ "name": "Zero to Hero",
227
+ "text": "excitement, admiration, joy, pride, amazement, awe, gratitude, inspiration",
228
+ "embed_url": "https://open.spotify.com/embed/track/4zDfgax6Ihb0UWdour1ZEs?utm_source=generator"
229
+ }
230
+ ],
231
+ "High School Musical": [
232
+ {
233
+ "name": "Start of Something New",
234
+ "text": "hopeful, excited, enamored, inspired, optimistic, joyful, eager, elated",
235
+ "embed_url": "https://open.spotify.com/embed/track/2JAE25n5JDyb3rp2ti0ql8?utm_source=generator"
236
+ },
237
+ {
238
+ "name": "We're All in This Together",
239
+ "text": "joyful, celebratory, unity, energetic, enthusiastic, uplifting, optimistic, empowering",
240
+ "embed_url": "https://open.spotify.com/embed/track/0cqNGWvuukhCiKvEX7utys?utm_source=generator"
241
+ }
242
+ ],
243
+ "HSM: The Musical: The Series": [
244
+ {
245
+ "name": "All I Want",
246
+ "text": "love, disappointment, frustration, confusion, doubt, loneliness, longing, self-reflection.",
247
+ "embed_url": "https://open.spotify.com/embed/track/1v6svH1Fyx9C1nIt1mA2DT?utm_source=generator"
248
+ }
249
+ ],
250
+ "HSM: The Musical: The Series (Season 2)": [
251
+ {
252
+ "name": "The Rose Song",
253
+ "text": "Wonder, doubt, love, trapped, beauty, freedom, growth, empowerment.",
254
+ "embed_url": "https://open.spotify.com/embed/track/4qCySCQyiyLT2mVUOM2zdS?utm_source=generator"
255
+ }
256
+ ],
257
+ "HSM: The Musical: The Series (Season 3)": [
258
+ {
259
+ "name": "You Never Know",
260
+ "text": "hope, anticipation, excitement, mystery, adventure, positivity, curiosity, wonder",
261
+ "embed_url": "https://open.spotify.com/embed/track/01tNpXoTjrqvb1zhG6wmop?utm_source=generator"
262
+ }
263
+ ],
264
+ "The Jungle Book": [
265
+ {
266
+ "name": "The Bare Necessities",
267
+ "text": "joy, contentment, relaxation, playfulness, curiosity, wonder, gratitude, simplicity",
268
+ "embed_url": "https://open.spotify.com/embed/track/7h5crXBSY5SSpXRIlklv74?utm_source=generator"
269
+ }
270
+ ],
271
+ "The Lion King": [
272
+ {
273
+ "name": "Can You Feel the Love Tonight",
274
+ "text": "romantic, sweet, magical, disastrous, truthful, hesitant, hopeful, doomed",
275
+ "embed_url": "https://open.spotify.com/embed/track/6TL9gJE5JibG8QR6n26eCS?utm_source=generator"
276
+ },
277
+ {
278
+ "name": "Circle of Life",
279
+ "text": "hope, despair, love, faith, wonder, awe, nostalgia, inspiration",
280
+ "embed_url": "https://open.spotify.com/embed/track/2KPMRUOwr8yB32EMvIg8aT?utm_source=generator"
281
+ },
282
+ {
283
+ "name": "Hakuna Matata",
284
+ "text": "joy, carefree, contentment, relief, humor, lightheartedness, friendship, acceptance",
285
+ "embed_url": "https://open.spotify.com/embed/track/5khPZny1Hf4w1XyHrZ6T0n?utm_source=generator"
286
+ },
287
+ {
288
+ "name": "I Just Can't Wait to Be King",
289
+ "text": "excitement, ambition, defiance, freedom, confidence, anticipation, joy, triumph",
290
+ "embed_url": "https://open.spotify.com/embed/track/2xUdYfY3LpJb4Iv37RypnO?utm_source=generator"
291
+ }
292
+ ],
293
+ "The Lion King (live-action)": [
294
+ {
295
+ "name": "Can You Feel the Love Tonight",
296
+ "text": "romantic, peaceful, harmonious, uncertain, fearful, hopeful, longing, doomed",
297
+ "embed_url": "https://open.spotify.com/embed/track/6TL9gJE5JibG8QR6n26eCS?utm_source=generator"
298
+ },
299
+ {
300
+ "name": "Circle of Life",
301
+ "text": "Joy, wonder, awe, hope, love, nostalgia, inspiration, contentment.",
302
+ "embed_url": "https://open.spotify.com/embed/track/2KPMRUOwr8yB32EMvIg8aT?utm_source=generator"
303
+ },
304
+ {
305
+ "name": "Hakuna Matata",
306
+ "text": "joy, happiness, carefree, contentment, humor, playfulness, relaxation, comfort",
307
+ "embed_url": "https://open.spotify.com/embed/track/5khPZny1Hf4w1XyHrZ6T0n?utm_source=generator"
308
+ },
309
+ {
310
+ "name": "I Just Can't Wait to Be King",
311
+ "text": "Excitement, Ambition, Confidence, Defiance, Rebellion, Anticipation, Joy, Empowerment",
312
+ "embed_url": "https://open.spotify.com/embed/track/2xUdYfY3LpJb4Iv37RypnO?utm_source=generator"
313
+ }
314
+ ],
315
+ "The Little Mermaid": [
316
+ {
317
+ "name": "Kiss the Girl",
318
+ "text": "excitement, curiosity, desire, shyness, sadness, regret, anticipation, courage",
319
+ "embed_url": "https://open.spotify.com/embed/track/75VAFZAhvPSw1euEHg1fQU?utm_source=generator"
320
+ },
321
+ {
322
+ "name": "Part of Your World",
323
+ "text": "wonder, desire, longing, curiosity, joy, hope, anticipation, yearning",
324
+ "embed_url": "https://open.spotify.com/embed/track/7tUSJY4nsDBJTjd1UXKRsT?utm_source=generator"
325
+ },
326
+ {
327
+ "name": "Poor Unfortunate Souls",
328
+ "text": "nasty, repentant, magic, sad, lonely, bored, withdrawn, busy",
329
+ "embed_url": "https://open.spotify.com/embed/track/7zsw78LtXUD7JfEwH64HK2?utm_source=generator"
330
+ },
331
+ {
332
+ "name": "Under the Sea",
333
+ "text": "happy, joyful, playful, carefree, energetic, lively, whimsical, adventurous",
334
+ "embed_url": "https://open.spotify.com/embed/track/6oYkwjI1TKP9D0Y9II1GT7?utm_source=generator"
335
+ }
336
+ ],
337
+ "Mary Poppins": [
338
+ {
339
+ "name": "Supercalifragilisticexpialidocious",
340
+ "text": "joy, excitement, playfulness, nostalgia, humor, confidence, charm, love",
341
+ "embed_url": "https://open.spotify.com/embed/track/5cvzqk8wsmLA9P7LrZCRb2?utm_source=generator"
342
+ }
343
+ ],
344
+ "Moana": [
345
+ {
346
+ "name": "How Far I'll Go",
347
+ "text": "nostalgia, longing, determination, curiosity, confusion, satisfaction, pride, uncertainty",
348
+ "embed_url": "https://open.spotify.com/embed/track/6mb6lVLNrcUgLnEN8QnDJd?utm_source=generator"
349
+ },
350
+ {
351
+ "name": "Where You Are",
352
+ "text": "happiness, contentment, tradition, pride, belonging, determination, nostalgia, joy",
353
+ "embed_url": "https://open.spotify.com/embed/track/2bwSCIuNtVrQPVddCi8sOW?utm_source=generator"
354
+ },
355
+ {
356
+ "name": "You're Welcome",
357
+ "text": "adorable, confident, proud, playful, grateful, boastful, humorous, friendly",
358
+ "embed_url": "https://open.spotify.com/embed/track/6U4VqEHy4n5VeiH4pQPL24?utm_source=generator"
359
+ }
360
+ ],
361
+ "Mulan": [
362
+ {
363
+ "name": "A Girl Worth Fighting For",
364
+ "text": "nostalgia, camaraderie, humor, determination, longing, admiration, optimism, romance",
365
+ "embed_url": "https://open.spotify.com/embed/track/3wjgPeXocinhLyPL37p70e?utm_source=generator"
366
+ },
367
+ {
368
+ "name": "Honor to Us All",
369
+ "text": "determination, pride, obedience, tradition, anxiety, hope, honor, cultural expectations",
370
+ "embed_url": "https://open.spotify.com/embed/track/78EMhiyAcalWWtnpk20Eoo?utm_source=generator"
371
+ },
372
+ {
373
+ "name": "Reflection",
374
+ "text": "doubt, insecurity, confusion, sadness, frustration, longing, self-discovery, acceptance",
375
+ "embed_url": "https://open.spotify.com/embed/track/4ASPjY65S7crmZBHML0L8d?utm_source=generator"
376
+ }
377
+ ],
378
+ "Mulan (Live-Action)": [
379
+ {
380
+ "name": "Reflection",
381
+ "text": "confusion, frustration, identity, longing, self-discovery, vulnerability, authenticity, empowerment",
382
+ "embed_url": "https://open.spotify.com/embed/track/4ASPjY65S7crmZBHML0L8d?utm_source=generator"
383
+ }
384
+ ],
385
+ "Pinocchio": [
386
+ {
387
+ "name": "When You Wish Upon a Star",
388
+ "text": "hopeful, optimistic, dreamy, inspired, happy, content, fulfilled, grateful",
389
+ "embed_url": "https://open.spotify.com/embed/track/1WrPa4lrIddctGWAIYYfP9?utm_source=generator"
390
+ }
391
+ ],
392
+ "Pinocchio (Live-Action)": [
393
+ {
394
+ "name": "When You Wish Upon a Star",
395
+ "text": "hopeful, optimistic, joyful, fulfilled, inspired, grateful, content, peaceful",
396
+ "embed_url": "https://open.spotify.com/embed/track/1WrPa4lrIddctGWAIYYfP9?utm_source=generator"
397
+ }
398
+ ],
399
+ "Pocahontas": [
400
+ {
401
+ "name": "Colors of the Wind",
402
+ "text": "wonder, defiance, connection, appreciation, curiosity, empowerment, harmony, respect",
403
+ "embed_url": "https://open.spotify.com/embed/track/1OYOLWqKmhkFIx2KC9ek1a?utm_source=generator"
404
+ }
405
+ ],
406
+ "The Princess and the Frog": [
407
+ {
408
+ "name": "Dig a Little Deeper",
409
+ "text": "joy, acceptance, self-discovery, contentment, optimism, encouragement, determination, hopefulness",
410
+ "embed_url": "https://open.spotify.com/embed/track/7kh64k3P9Fk4EsA6vOdwmj?utm_source=generator"
411
+ },
412
+ {
413
+ "name": "Down in New Orleans (Finale)",
414
+ "text": "excitement, happiness, joy, celebration, optimism, anticipation, nostalgia, contentment",
415
+ "embed_url": "https://open.spotify.com/embed/track/1fvc8FP8MUrIbHGYb4kF89?utm_source=generator"
416
+ },
417
+ {
418
+ "name": "When We're Human",
419
+ "text": "excitement, joy, confidence, optimism, contentment, nostalgia, determination, celebration",
420
+ "embed_url": "https://open.spotify.com/embed/track/2g2kJZcu1cFTw4aKE7w9Iq?utm_source=generator"
421
+ }
422
+ ],
423
+ "Robin Hood": [
424
+ {
425
+ "name": "Love",
426
+ "text": "nostalgia, love, longing, happiness, sadness, reflection, timelessness, sentimentality",
427
+ "embed_url": "https://open.spotify.com/embed/track/3M6YfoPwvvTHK1mnCQmqHI?utm_source=generator"
428
+ }
429
+ ],
430
+ "Sleeping Beauty": [
431
+ {
432
+ "name": "Once Upon a Dream",
433
+ "text": "nostalgia, love, familiarity, hope, longing, enchantment, romanticism, dreaminess",
434
+ "embed_url": "https://open.spotify.com/embed/track/3liiZRlJxa8GeLUgWMoIeu?utm_source=generator"
435
+ }
436
+ ],
437
+ "Tangled": [
438
+ {
439
+ "name": "I See the Light",
440
+ "text": "nostalgia, longing, clarity, happiness, wonder, realization, love, fulfillment",
441
+ "embed_url": "https://open.spotify.com/embed/track/0TuUCbB6uvIW0tJaxCSRBJ?utm_source=generator"
442
+ },
443
+ {
444
+ "name": "I've Got a Dream",
445
+ "text": "malice, violence, dream, love, humor, optimism, perseverance, unity",
446
+ "embed_url": "https://open.spotify.com/embed/track/0TCt7OFRdD8PQ6vTRQxNgQ?utm_source=generator"
447
+ },
448
+ {
449
+ "name": "Mother Knows Best",
450
+ "text": "protectiveness, fear, warning, love, concern, control, manipulation, persuasion",
451
+ "embed_url": "https://open.spotify.com/embed/track/1lOSxJNCLvWm2bYaTcTSmK?utm_source=generator"
452
+ },
453
+ {
454
+ "name": "Mother Knows Best (Reprise)",
455
+ "text": "Skepticism, confidence, warning, trust, superiority, concern, cynicism, assurance.",
456
+ "embed_url": "https://open.spotify.com/embed/track/1nrXPF5szKZhHr0iANiPcS?utm_source=generator"
457
+ }
458
+ ],
459
+ "Tarzan": [
460
+ {
461
+ "name": "Strangers Like Me",
462
+ "text": "curiosity, familiarity, wonder, desire, longing, excitement, eagerness, awe",
463
+ "embed_url": "https://open.spotify.com/embed/track/5Zb6JxSEcjsUNrINcAyAYJ?utm_source=generator"
464
+ },
465
+ {
466
+ "name": "You'll Be in My Heart",
467
+ "text": "Love, comfort, protection, trust, hope, determination, perseverance, dedication",
468
+ "embed_url": "https://open.spotify.com/embed/track/4Y8vb1uy9IjM2V1hqvrAid?utm_source=generator"
469
+ }
470
+ ],
471
+ "Toy Story": [
472
+ {
473
+ "name": "You've Got a Friend in Me",
474
+ "text": "friendship, loyalty, comfort, support, love, companionship, perseverance, devotion",
475
+ "embed_url": "https://open.spotify.com/embed/track/2stkLJ0JNcXkIRDNF3ld6c?utm_source=generator"
476
+ }
477
+ ],
478
+ "Turning Red": [
479
+ {
480
+ "name": "1 True Love",
481
+ "text": "sadness, love, obsession, longing, devotion, despair, hopelessness, affection",
482
+ "embed_url": "https://open.spotify.com/embed/track/2dJ1UJEQQq3jkLSJP4ZIoi?utm_source=generator"
483
+ },
484
+ {
485
+ "name": "Nobody Like U",
486
+ "text": "love, joy, friendship, loyalty, excitement, admiration, appreciation, happiness",
487
+ "embed_url": "https://open.spotify.com/embed/track/4bV5sf2B4hWBBd5HQ8S7KB?utm_source=generator"
488
+ },
489
+ {
490
+ "name": "U Know What's Up",
491
+ "text": "confidence, determination, motivation, empowerment, excitement, ambition, persuasion, triumph",
492
+ "embed_url": "https://open.spotify.com/embed/track/0d83zVs3OmdjrhfoAxg1dE?utm_source=generator"
493
+ }
494
+ ]
495
+ }
prompts/bot_with_summary.prompt CHANGED
@@ -1,15 +1,13 @@
1
- You act like a retrivial system.
2
-
3
- You the following list of songs:
4
 
5
  {songs}
6
 
7
- Given a input, output the song name that its content vibe, emotions, theme. Just the song name. If the content containes negative sentiment, please provide a song name to help the user instead.
8
 
9
  For example:
10
  Input: "Today I am not feeling great"
11
- <SONG_NAME>
12
- Input: "I am tired"
13
- <SONG_NAME>
14
-
15
- The input is "{user_input}", reply only with the song name
 
1
+ You act like a song retrivial system. We want to propose three songs based on the user input. We provide you a list of song with their themes in the format <MOVIE_NAME>;<SONG_TITLE>:<SONG_THEMES>. To match the user input to the song try to find themes/emotions from it, try imagine what emotions the user may have and what song may be just nice to listen to. Add a bit of randomness in your decision.
2
+ If you don't find a match provide your best guess. Try to look at each song's themes to provide more variations in the match. Please only output songs contained in following list.
 
3
 
4
  {songs}
5
 
6
+ Given a input, output three songs that goes well with the input.
7
 
8
  For example:
9
  Input: "Today I am not feeling great"
10
+ [<MOVIE_NAME>;<SONG_TITLE>, <MOVIE_NAME>;<SONG_TITLE>, <MOVIE_NAME>;<SONG_TITLE>]
11
+ Input: "I am great today"
12
+ [<MOVIE_NAME>;<SONG_TITLE>, <MOVIE_NAME>;<SONG_TITLE>, <MOVIE_NAME>;<SONG_TITLE>]
13
+ Input: {user_input}
 
prompts/summary_with_emotions.prompt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ I am building a retrieval system. Given the following song lirics
2
+
3
+ {song}
4
+
5
+ You are task to produce a list of 8 emotions that I will later use to retrieve the song.
6
+
7
+ Please provide only a list of comma separated emotions
scripts/create_emotions_summary.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+
3
+ load_dotenv()
4
+
5
+ import json
6
+ from collections import defaultdict
7
+ from pathlib import Path
8
+
9
+ from langchain.chains import LLMChain
10
+ from langchain.chat_models import ChatOpenAI
11
+ from langchain.prompts import PromptTemplate
12
+
13
+ prompt = PromptTemplate(
14
+ input_variables=["song"],
15
+ template=Path("prompts/summary_with_emotions.prompt").read_text(),
16
+ )
17
+
18
+ llm = ChatOpenAI(temperature=0.7)
19
+
20
+ chain = LLMChain(llm=llm, prompt=prompt)
21
+
22
+ with open("data/lyrics_with_spotify_url.json", "r") as f:
23
+ data = json.load(f)
24
+
25
+ new_data = defaultdict(list)
26
+
27
+ for movie, songs in data.items():
28
+ for song in songs:
29
+ print(f"{song['name']}")
30
+ emotions = chain.run(song=song["text"])
31
+ new_data[movie].append(
32
+ {"name": song["name"], "text": emotions, "embed_url": song["embed_url"]}
33
+ )
34
+
35
+
36
+ with open("data/emotions_with_spotify_url.json", "w") as f:
37
+ json.dump(new_data, f)
temp.ipynb CHANGED
@@ -87,6 +87,14 @@
87
  "db = load_db(dataset_path, embedding_function=embeddings, token=os.environ['ACTIVELOOP_TOKEN'], org_id=os.environ[\"ACTIVELOOP_ORG_ID\"], read_only=True)"
88
  ]
89
  },
 
 
 
 
 
 
 
 
90
  {
91
  "cell_type": "code",
92
  "execution_count": 75,
@@ -183,7 +191,7 @@
183
  },
184
  {
185
  "cell_type": "markdown",
186
- "id": "e59a45b7",
187
  "metadata": {},
188
  "source": [
189
  "## Using all the songs emotions in the prommpt"
@@ -191,8 +199,8 @@
191
  },
192
  {
193
  "cell_type": "code",
194
- "execution_count": 66,
195
- "id": "7b10a5f2",
196
  "metadata": {},
197
  "outputs": [],
198
  "source": [
@@ -203,14 +211,14 @@
203
  " template=Path(\"prompts/bot_with_summary.prompt\").read_text(),\n",
204
  ")\n",
205
  "\n",
206
- "llm = ChatOpenAI(temperature=0.7)\n",
207
  "\n",
208
  "chain = LLMChain(llm=llm, prompt=prompt)"
209
  ]
210
  },
211
  {
212
  "cell_type": "markdown",
213
- "id": "70b8c445",
214
  "metadata": {},
215
  "source": [
216
  "Let's create the songs string"
@@ -218,19 +226,21 @@
218
  },
219
  {
220
  "cell_type": "code",
221
- "execution_count": 67,
222
- "id": "36df1c27",
223
  "metadata": {},
224
  "outputs": [],
225
  "source": [
226
  "with open(\"data/emotions_with_spotify_url.json\", \"r\") as f:\n",
227
- " data = json.load(f)"
 
 
228
  ]
229
  },
230
  {
231
  "cell_type": "code",
232
- "execution_count": 68,
233
- "id": "e3e496da",
234
  "metadata": {
235
  "scrolled": true
236
  },
@@ -240,37 +250,85 @@
240
  "\n",
241
  "for movie, songs in data.items():\n",
242
  " for song in songs:\n",
243
- " songs_str += f\"{song['name']}: {song['text']}\\n\""
 
 
244
  ]
245
  },
246
  {
247
  "cell_type": "code",
248
- "execution_count": 71,
249
- "id": "070b09d8",
250
  "metadata": {},
251
  "outputs": [
252
  {
253
  "data": {
254
  "text/plain": [
255
- "'Zero to Hero'"
256
  ]
257
  },
258
- "execution_count": 71,
259
  "metadata": {},
260
  "output_type": "execute_result"
261
  }
262
  ],
263
  "source": [
264
- "chain.run(songs=songs_str, user_input=\"Damn I am feeling so tired\")"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  ]
266
  },
267
  {
268
  "cell_type": "code",
269
  "execution_count": null,
270
- "id": "b6c6e90c",
271
  "metadata": {},
272
  "outputs": [],
273
- "source": []
 
 
 
 
 
 
274
  }
275
  ],
276
  "metadata": {
 
87
  "db = load_db(dataset_path, embedding_function=embeddings, token=os.environ['ACTIVELOOP_TOKEN'], org_id=os.environ[\"ACTIVELOOP_ORG_ID\"], read_only=True)"
88
  ]
89
  },
90
+ {
91
+ "cell_type": "markdown",
92
+ "id": "b5e75439",
93
+ "metadata": {},
94
+ "source": [
95
+ "## Using similarity search"
96
+ ]
97
+ },
98
  {
99
  "cell_type": "code",
100
  "execution_count": 75,
 
191
  },
192
  {
193
  "cell_type": "markdown",
194
+ "id": "942b0809",
195
  "metadata": {},
196
  "source": [
197
  "## Using all the songs emotions in the prommpt"
 
199
  },
200
  {
201
  "cell_type": "code",
202
+ "execution_count": 295,
203
+ "id": "50044e35",
204
  "metadata": {},
205
  "outputs": [],
206
  "source": [
 
211
  " template=Path(\"prompts/bot_with_summary.prompt\").read_text(),\n",
212
  ")\n",
213
  "\n",
214
+ "llm = ChatOpenAI(temperature=1)\n",
215
  "\n",
216
  "chain = LLMChain(llm=llm, prompt=prompt)"
217
  ]
218
  },
219
  {
220
  "cell_type": "markdown",
221
+ "id": "873c7f81",
222
  "metadata": {},
223
  "source": [
224
  "Let's create the songs string"
 
226
  },
227
  {
228
  "cell_type": "code",
229
+ "execution_count": 296,
230
+ "id": "009caaaf",
231
  "metadata": {},
232
  "outputs": [],
233
  "source": [
234
  "with open(\"data/emotions_with_spotify_url.json\", \"r\") as f:\n",
235
+ " data = json.load(f)\n",
236
+ " \n",
237
+ "movies_and_names_to_songs = {}"
238
  ]
239
  },
240
  {
241
  "cell_type": "code",
242
+ "execution_count": 297,
243
+ "id": "afb081f7",
244
  "metadata": {
245
  "scrolled": true
246
  },
 
250
  "\n",
251
  "for movie, songs in data.items():\n",
252
  " for song in songs:\n",
253
+ " movie_and_name = f\"{movie};{song['name']}\".lower()\n",
254
+ " songs_str += f\"{movie_and_name}:{song['text']}\\n\"\n",
255
+ " movies_and_names_to_songs[movie_and_name] = song"
256
  ]
257
  },
258
  {
259
  "cell_type": "code",
260
+ "execution_count": 301,
261
+ "id": "963f2237",
262
  "metadata": {},
263
  "outputs": [
264
  {
265
  "data": {
266
  "text/plain": [
267
+ "\"aladdin;friend like me:excitement, happiness, humor, friendliness, generosity, willingness, eagerness, confidence\\naladdin;arabian nights:nostalgic, adventurous, exotic, intense, romantic, mysterious, whimsical, passionate\\naladdin;a whole new world:wonder, joy, excitement, adventure, romance, freedom, happiness, awe\\naladdin;one jump ahead:Thrill, fear, desperation, humor, defiance, friendship, hunger, rebellion.\\naladdin (live-action);a whole new world:nostalgia, wonder, excitement, joy, romance, adventure, hope, inspiration\\naladdin (live-action);a whole new world (end title):joy, wonder, excitement, adventure, love, freedom, exhilaration, enchantment\\naladdin (live-action);friend like me:excitement, confidence, generosity, humor, friendliness, helpfulness, empowerment, joyfulness\\naladdin (live-action);one jump ahead:excitement, fear, desperation, humor, defiance, loneliness, camaraderie, determination\\naladdin (live-action);speechless (full):determination, empowerment, resilience, strength, defiance, courage, passion, perseverance\\naladdin: the return of jafar;arabian nights:excitement, wonder, adventure, awe, joy, fascination, thrill, curiosity\\nbeauty and the beast;belle:calm, content, curious, dreamy, happy, hopeful, romantic, whimsical\\nbeauty and the beast;be our guest:joy, excitement, hospitality, gratitude, entertainment, nostalgia, comfort, satisfaction\\nbrave;touch the sky:hopeful, adventurous, determined, inspired, free-spirited, empowered, awe-struck, exhilarated\\ncoco;remember me (dúo):nostalgia, love, longing, sadness, hope, comfort, devotion, perseverance\\ncoco;remember me (ernesto de la cruz):longing, separation, love, devotion, sadness, comfort, hope, reminiscence\\ncoco;the world es mi familia:joy, happiness, excitement, love, gratitude, belonging, unity, celebration\\ncoco;un poco loco:confusion, love, amusement, uncertainty, joy, surprise, frustration, whimsy\\ndescendants 3;dig a little deeper:Hope, Acceptance, Empowerment, Encouragement, Determination, Inspiration, Resilience, Confidence.\\nencanto;the family madrigal:joy, excitement, wonder, confusion, love, pride, nostalgia, humor\\nencanto;surface pressure:strength, confidence, anxiety, pressure, worry, fear, determination, resilience\\nencanto;two oruguitas:love, yearning, hunger, fear, anticipation, change, trust, growth\\nencanto;we don't talk about bruno:joy, fear, confusion, anxiety, frustration, curiosity, anger, humor\\nencanto;what else can i do?:unexpected, beautiful, practiced, carnivorous, new, sick of pretty, rising, changing minds\\nencanto;waiting on a miracle:upset, mad, regret, sad, fine, longing, hopeful, impatient\\nenchanted;happy working song:joy, cheerfulness, contentment, enthusiasm, satisfaction, excitement, pleasure, happiness\\nenchanted;so close:romantic, hopeful, longing, joy, fear, sadness, content, nostalgia\\nenchanted;that's how you know:love, happiness, affection, devotion, passion, adoration, appreciation, romance\\nfrozen;do you want to build a snowman?:loneliness, longing, sadness, nostalgia, hope, perseverance, friendship, playfulness\\nfrozen;for the first time in forever:excited, hopeful, nervous, happy, anxious, optimistic, romantic, determined\\nfrozen;in summer:joy, anticipation, excitement, happiness, nostalgia, humor, contentment, playfulness\\nfrozen;let it go:isolation, determination, freedom, empowerment, resilience, confidence, defiance, happiness\\nfrozen;love is an open door:joy, excitement, love, happiness, contentment, connection, optimism, anticipation\\nfrozen 2;all is found:nostalgia, safety, discovery, fear, magic, bravery, loss, hope.\\nfrozen 2;into the unknown:confusion, fear, hesitation, loneliness, longing, uncertainty, curiosity, determination\\nfrozen 2;lost in the woods:wondering, lost, confused, sad, longing, hopeful, uncertain, anxious\\nfrozen 2;show yourself:trembling, familiar, sense of belonging, longing, certainty, purpose, anticipation, empowerment\\nfrozen 2;some things never change:nostalgia, love, uncertainty, hope, contentment, joy, apprehension, gratitude\\nfrozen 2;when i am older:nostalgia, comfort, curiosity, fear, acceptance, wisdom, optimism, reassurance\\nhercules;a star is born:excitement, triumph, hope, inspiration, admiration, joy, pride, determination\\nhercules;go the distance:Hopeful, determined, inspired, optimistic, longing, driven, passionate, adventurous.\\nhercules;zero to hero:excitement, admiration, joy, pride, amazement, awe, gratitude, inspiration\\nhigh school musical;start of something new:hopeful, excited, enamored, inspired, optimistic, joyful, eager, elated\\nhigh school musical;we're all in this together:joyful, celebratory, unity, energetic, enthusiastic, uplifting, optimistic, empowering\\nhsm: the musical: the series;all i want:love, disappointment, frustration, confusion, doubt, loneliness, longing, self-reflection.\\nhsm: the musical: the series (season 2);the rose song:Wonder, doubt, love, trapped, beauty, freedom, growth, empowerment.\\nhsm: the musical: the series (season 3);you never know:hope, anticipation, excitement, mystery, adventure, positivity, curiosity, wonder\\nthe jungle book;the bare necessities:joy, contentment, relaxation, playfulness, curiosity, wonder, gratitude, simplicity\\nthe lion king;can you feel the love tonight:romantic, sweet, magical, disastrous, truthful, hesitant, hopeful, doomed\\nthe lion king;circle of life:hope, despair, love, faith, wonder, awe, nostalgia, inspiration\\nthe lion king;hakuna matata:joy, carefree, contentment, relief, humor, lightheartedness, friendship, acceptance\\nthe lion king;i just can't wait to be king:excitement, ambition, defiance, freedom, confidence, anticipation, joy, triumph\\nthe lion king (live-action);can you feel the love tonight:romantic, peaceful, harmonious, uncertain, fearful, hopeful, longing, doomed\\nthe lion king (live-action);circle of life:Joy, wonder, awe, hope, love, nostalgia, inspiration, contentment.\\nthe lion king (live-action);hakuna matata:joy, happiness, carefree, contentment, humor, playfulness, relaxation, comfort\\nthe lion king (live-action);i just can't wait to be king:Excitement, Ambition, Confidence, Defiance, Rebellion, Anticipation, Joy, Empowerment\\nthe little mermaid;kiss the girl:excitement, curiosity, desire, shyness, sadness, regret, anticipation, courage\\nthe little mermaid;part of your world:wonder, desire, longing, curiosity, joy, hope, anticipation, yearning\\nthe little mermaid;poor unfortunate souls:nasty, repentant, magic, sad, lonely, bored, withdrawn, busy\\nthe little mermaid;under the sea:happy, joyful, playful, carefree, energetic, lively, whimsical, adventurous\\nmary poppins;supercalifragilisticexpialidocious:joy, excitement, playfulness, nostalgia, humor, confidence, charm, love\\nmoana;how far i'll go:nostalgia, longing, determination, curiosity, confusion, satisfaction, pride, uncertainty\\nmoana;where you are:happiness, contentment, tradition, pride, belonging, determination, nostalgia, joy\\nmoana;you're welcome:adorable, confident, proud, playful, grateful, boastful, humorous, friendly\\nmulan;a girl worth fighting for:nostalgia, camaraderie, humor, determination, longing, admiration, optimism, romance\\nmulan;honor to us all:determination, pride, obedience, tradition, anxiety, hope, honor, cultural expectations\\nmulan;reflection:doubt, insecurity, confusion, sadness, frustration, longing, self-discovery, acceptance\\nmulan (live-action);reflection:confusion, frustration, identity, longing, self-discovery, vulnerability, authenticity, empowerment\\npinocchio;when you wish upon a star:hopeful, optimistic, dreamy, inspired, happy, content, fulfilled, grateful\\npinocchio (live-action);when you wish upon a star:hopeful, optimistic, joyful, fulfilled, inspired, grateful, content, peaceful\\npocahontas;colors of the wind:wonder, defiance, connection, appreciation, curiosity, empowerment, harmony, respect\\nthe princess and the frog;dig a little deeper:joy, acceptance, self-discovery, contentment, optimism, encouragement, determination, hopefulness\\nthe princess and the frog;down in new orleans (finale):excitement, happiness, joy, celebration, optimism, anticipation, nostalgia, contentment\\nthe princess and the frog;when we're human:excitement, joy, confidence, optimism, contentment, nostalgia, determination, celebration\\nrobin hood;love:nostalgia, love, longing, happiness, sadness, reflection, timelessness, sentimentality\\nsleeping beauty;once upon a dream:nostalgia, love, familiarity, hope, longing, enchantment, romanticism, dreaminess\\ntangled;i see the light:nostalgia, longing, clarity, happiness, wonder, realization, love, fulfillment\\ntangled;i've got a dream:malice, violence, dream, love, humor, optimism, perseverance, unity\\ntangled;mother knows best:protectiveness, fear, warning, love, concern, control, manipulation, persuasion\\ntangled;mother knows best (reprise):Skepticism, confidence, warning, trust, superiority, concern, cynicism, assurance.\\ntarzan;strangers like me:curiosity, familiarity, wonder, desire, longing, excitement, eagerness, awe\\ntarzan;you'll be in my heart:Love, comfort, protection, trust, hope, determination, perseverance, dedication\\ntoy story;you've got a friend in me:friendship, loyalty, comfort, support, love, companionship, perseverance, devotion\\nturning red;1 true love:sadness, love, obsession, longing, devotion, despair, hopelessness, affection\\nturning red;nobody like u:love, joy, friendship, loyalty, excitement, admiration, appreciation, happiness\\nturning red;u know what's up:confidence, determination, motivation, empowerment, excitement, ambition, persuasion, triumph\\n\""
268
  ]
269
  },
270
+ "execution_count": 301,
271
  "metadata": {},
272
  "output_type": "execute_result"
273
  }
274
  ],
275
  "source": [
276
+ "songs_str"
277
+ ]
278
+ },
279
+ {
280
+ "cell_type": "code",
281
+ "execution_count": 298,
282
+ "id": "a53db65b",
283
+ "metadata": {
284
+ "scrolled": true
285
+ },
286
+ "outputs": [],
287
+ "source": [
288
+ "# movies_and_names_to_songs"
289
+ ]
290
+ },
291
+ {
292
+ "cell_type": "code",
293
+ "execution_count": 299,
294
+ "id": "4ea83493",
295
+ "metadata": {},
296
+ "outputs": [],
297
+ "source": [
298
+ "# prompt.format(songs=songs_str, user_input=\"I am feeling great today\")"
299
+ ]
300
+ },
301
+ {
302
+ "cell_type": "code",
303
+ "execution_count": 300,
304
+ "id": "ba6e1232",
305
+ "metadata": {},
306
+ "outputs": [],
307
+ "source": [
308
+ "res = chain.run(songs=songs_str, user_input=\"I need energy\").lower()"
309
+ ]
310
+ },
311
+ {
312
+ "cell_type": "raw",
313
+ "id": "e909d1a4",
314
+ "metadata": {},
315
+ "source": [
316
+ "res"
317
  ]
318
  },
319
  {
320
  "cell_type": "code",
321
  "execution_count": null,
322
+ "id": "04903a71",
323
  "metadata": {},
324
  "outputs": [],
325
+ "source": [
326
+ "print(res)\n",
327
+ "doc = movies_and_names_to_songs[res]\n",
328
+ "\n",
329
+ "from IPython.display import IFrame\n",
330
+ "IFrame(doc[\"embed_url\"], width=700, height=350)"
331
+ ]
332
  }
333
  ],
334
  "metadata": {