Your Personalized Palette, Powered by AI
Palette AI is a web application that generates personalized color palettes powered by AI. It is developed as a submission for the Supabase Open Source Hackathon 2024.
The color palette is generated based on the purpose, targeted audience, theme, and additional information provided by the user. The generated color palette can be saved to the Supabase database for future reference.
- Generate Color Palette: Users can generate a color palette by providing information about the purpose, targeted audience, theme, and additional comments.
- Save Color Palette: Generated color palettes can be saved to the Supabase database for future reference.
- Responsive Design: The web application is designed to be responsive and user-friendly.
- Exploration: A page to search the generated color palettes.
To get a local copy up and running follow these simple steps.
- Python
- Pip
- Supabase | The Open Source Firebase Alternative
- Streamlit • A faster way to build and share data apps
-
Clone the repo
git clone https://github.com/dotAadarsh/PaletteAI.git
-
Install the packages
pip install -r requirements.txt
-
Add your secret keys in the
.streamlit/secrets.toml
file[secrets] GEMINI_API_KEY = "<YOUR_GEMINI_API_KEY>" SUPABASE_URL = "<YOUR_SUPABASE_URL>" SUPABASE_KEY = "<YOUR_SUPABASE_KEY>"
-
Run the application
streamlit run app.py
- Select purpose, targeted audience, theme, and the number of colors.
- Provide additional information in the text input if needed.
- Click on Generate Color Palette.
- The generated color palette will be displayed.
- Click on Save Color Palette to save the palette to the Supabase database.
- Use the Explore tab to find all the generated color palettes
You can find the code that is deployed to generate the image in the functions/text-to-image/index.ts file.
Explanation: This Deno script sets up an HTTP server that converts text prompts into images using the Hugging Face Inference library. It imports the serve
function from the Deno standard library for HTTP server and the HfInference
class from the Hugging Face Inference library. After parsing the JSON data from the request, it uses the Hugging Face Inference library to convert the received text prompt into an image, employing the model 'stabilityai/stable-diffusion-2' and disabling caching. Finally, it returns the converted image as the response.
This code is deployed to the Supabase Edge Function. A seprate URL is generated once deployed which we can access it to generate the image.
Read this Hugging Face Inference API for more info. Note: You need to add the Hugging Face API.
So I though of implement a full text search for the generated color palette. PGroonga is a PostgreSQL extension adding a full text search indexing method based on Groonga. Follow PGroonga: Multilingual Full Text Search guide to know how to use this. Here is the screenshot of its implementation on Supabase SQL Editor.