Skip to content

Commit

Permalink
feat: better artist result
Browse files Browse the repository at this point in the history
  • Loading branch information
Dun-sin committed Mar 2, 2023
1 parent fcee88e commit 37e15af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/DisplayResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const DisplayResult = ({ isLoading, playListData, buttonClick, errorMessages })
return (
<>
{!isLoading.state &&
<section className='bg-gray-200 md:min-w-[40vw] md:max-w-[50%] min-w-[300px] p-4 rounded'>
<section className='bg-gray-200 sm:min-w-[40vw] max-w-[500px] min-w-[300px] p-4 rounded'>
{(playListData.link.length !== 0 && playListData.name.length !== 0)
?
<>
Expand Down
11 changes: 7 additions & 4 deletions src/components/GeneratePlaylist/DiscoverNewSongs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,25 @@ const DiscoverNewSongs = ({ logOut }) => {
setButtonClicked(true)

try {
const type = isDifferentTypesOfArtists ? 'completely different' : 'similar';
const type = isDifferentTypesOfArtists ? 'completely different' : 'the same';
const popularity = isNotPopularArtists ? 'not popular' : 'popular';
const prompt = `Give me 20 musicians who are ${popularity} and ${type} to the following artists provided: ${artists.join(', ')}. Be sure none of the musicians listed overlap with those provided and that the result is not in list form and not more than 20 musicians. The results should also be separated by a comma.`;


const newPrompt = `Please analyze the following list of musicians: '${artists.join(', ')}', and identify the sub-genre that is associated with 70 - 90% of them. Based on this analysis, please provide a list of 20 musicians who are ${popularity} and are ${type} as the sub-genres. Please ensure that the resulting list does not include any of the musicians from the original list provided. To help narrow down the results, please only provide the list of recommended musicians separated by commas.`

setIsLoading((prevState) => ({ ...prevState, message: `Getting the list of new artists` }));
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: prompt,
prompt: newPrompt,
max_tokens: 1024,
temperature: 1,
temperature: 0.9,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
});

const artistList = response.data.choices[0].text.replace(/:\n/g, "").trimStart().split(", ");
const artistList = response.data.choices[0].text.replace(/:\n/g, "").trimStart().split(':').at(-1).split(', ');
(artistList.length > 20) ? (artistList.length = 20) : null

setIsLoading((prevState) => ({ ...prevState, message: `Getting the albums of each artist` }));
Expand Down

1 comment on commit 37e15af

@vercel
Copy link

@vercel vercel bot commented on 37e15af Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hear-it-fresh – ./

hear-it-fresh-dun-sin.vercel.app
hearitfresh.vercel.app
hear-it-fresh-git-main-dun-sin.vercel.app

Please sign in to comment.