Skip to content

kennethwoanyah/bruceai

Repository files navigation

Bruce AI is a Streamlit web application designed for mood analysis and music recommendation. Here's a breakdown of its main components:

Imports: The script imports necessary libraries such as streamlit, openai, and spotify. These are used for building the web interface, interacting with OpenAI's API, and accessing Spotify's music database, respectively.

OpenAI Integration:

The script uses the OpenAI API to analyze the mood from user input. The extract_mood function takes user input, sends it to OpenAI's API, and receives a mood keyword in return. Spotify Integration:

The get_spotify_song function searches for a song on Spotify that matches the mood keyword returned by the OpenAI API. It uses the Spotify API to fetch a song suggestion and displays it on the Streamlit interface, including an embedded Spotify player. Text-to-Audio Synthesis:

The generate_new_song function uses the OpenAI API to generate text based on the user's input. It then converts this text into audio using a text-to-audio synthesis pipeline from the transformers library. Streamlit Web App:

The main function defines the structure of the web app. It includes options for users to enter data related to sleep or activity and choose between getting a Spotify song suggestion or generating a new song. User inputs are collected through various Streamlit widgets like text inputs, sliders, and radio buttons. Depending on the user's choice, it either generates a new song or fetches a song suggestion from Spotify. Feedback Mechanism:

The app includes 'Like' and 'Dislike' buttons for user feedback. However, the feature seems to be under development. Running the App:

The script is meant to be run as a Streamlit application. When executed, it starts a local web server and serves the app interface. Spotify Credentials:

The script contains hard-coded Spotify client credentials, which is generally not a secure practice. It’s advisable to store such sensitive information in environment variables or secure files. Overall, the script is a sophisticated integration of AI and music streaming services to provide mood-based song recommendations. However, the 'generate_new_song' function and some feedback features are marked as under development, indicating the app is not fully complete.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors