Skip to content

shaunak-badani/WordWeight

Repository files navigation

WordWeight

An application aiding in understanding the importance of tokens in different parts of an image generated by a diffusion model.

How to run:

  • Running the predict code
# Option 1 - to test if packages are installed correctly
cd replicate
python predict.py 

# Option 2 - via cog. Needs docker to be installed locally
pip install cog
cog predict -i prompt="a futuristic cityscape" -i mode="generate" -i mask_path=@masked_image.png
cog predict -i prompt="a futuristic cityscape" -i mode="explain" -i mask_path=@masked_image.png
  • Frontend
cd frontend
npm install
npm run dev
  • Backend
cd backend
# Create a .env file with the following environment variables:
# REPLICATE_API_TOKEN=<your replicate api token here>
# For localhost db setup, you can type the following:
# POSTGRESQL_USERNAME=postgres
# POSTGRESQL_PASSWORD=password
# POSTGRESQL_URL=localhost:5432
# POSTGRESQL_DBNAME=app_db
export $(grep -v '^#' .env | xargs)
uvicorn src.main:app --reload
  • Local database (run via docker)
sudo docker compose -f docker-compose-db.yml up

About

An explainable AI project which tries to figure out which tokens contribute the most to an image model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors