Skip to content

dotAadarsh/PaletteAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palette AI 🎨

Your Personalized Palette, Powered by AI

PaletteAI

Introduction

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.

Built With

Features

  • 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.

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

Installation

  1. Clone the repo

    git clone https://github.com/dotAadarsh/PaletteAI.git
  2. Install the packages

    pip install -r requirements.txt
  3. Add your secret keys in the .streamlit/secrets.tomlfile

    [secrets]
    GEMINI_API_KEY = "<YOUR_GEMINI_API_KEY>"
    SUPABASE_URL = "<YOUR_SUPABASE_URL>"
    SUPABASE_KEY = "<YOUR_SUPABASE_KEY>"
    
  4. Run the application

    streamlit run app.py
    

Usage

  • 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

SQL Definition

SQL Defition

Supabase Edge Function

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.

Exploring PGroonga: Multilingual Full Text Search

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.

SQL-Editor