# FRAP: Faithful and Realistic Text-to-Image Generation with Adaptive Prompt Weighting
## Code for TMLR submission. Do not distribute.

## Description
Official implementation of our paper.

## Setup
To setup and activate the environment, please run:
```
conda env create -f environment/environment.yaml
conda activate frap
```

## Datasets
We provide all the datasets used in the paper at "datasets". Each dataset is a text file including the prompts.

## Run interactively in jupyter notebook
To perform text-to-image generation with FRAP, use the provided "run_frap.ipynb" file. This uses the default configurations defined in "config_frap.py".

## Run from command line
To manually provide a list of prompts:
```
python run_frap.py --prompt='["A black cat sitting on top of a green bench in a field"]' --seeds [10,48] --output_path outputs/images/
```

To run on a ".txt" file containing prompts (one prompt per line):
```
python run_frap.py --prompt_file="datasets/divide_and_bind/coco_attribute.txt" --seeds [0,1] --output_path outputs/coco_attribute/
```