Hi,
I´m trying to create a simple app that recommends 5 songs based on a mood given. However, the songs should be picked from a personal song dataset.
I´m currently using pandasai for this to extract the dataset from a CSV file, however, the script is taking quite long to run and I´m only running it with a small dataset of 200 songs.
Any ideas on how I can run this more effectively?
Current script:
import pandas as pd
from pandasai import PandasAI
from pandasai.llm.openai import OpenAI
‘name’ (song name), ‘artist’ (artist name), ‘valence’, ‘energy’
songs_df = pd.read_csv(‘recommendations.csv’) # replace ‘songs.csv’ with your actual csv file
Instantiate a LLM
llm = OpenAI(api_token=“XXXX”)
pandas_ai = PandasAI(llm, conversational=False)
#recommend songs prompt
recommendation_prompt = “recommend 5 songs that fit this mood: Chilling in the ocean. List it in this format: \n1. track_name,track_id \n2. track_name,track_id \n3…”
Use pandasai to get the recommendation
recommendation = pandas_ai(songs_df, prompt=recommendation_prompt)
print(recommendation)