README.md
Text-to-Image Generator with Memory
Ever wished you could remember the prompt that generated that cool image you made? This project gives you a way to save the generated images you love back to your repository, alongside the prompt that generated it and other metadata.
Navigate to the Capsules tab to try it for yourself, and save some data back to the repository!
Browse what's been created
Click through previous prompts and images using the left-hand file browser through the UI. Or for more native browsing, use the Access button to copy code to stream this repository, then open the images/
folder with your preferred file browser to see the various prompts and images that people have saved in the past.
Duplicate to save to your own repository
Use Text-to-Image Generator as a starting point for your own GenAI app and customize away! Click the Duplicate button in the top right to make a copy of this project in your account. Use the Settings tab to set visibility to Private if you want to keep your images to yourself.
Once you have your own copy, develop locally with the tools of your choice:
Working with Xet CLI or PyXet
Copy the full repository to your machine:
xet cp -r xet://XetHub/Text-to-Image-Generator/main Text-to-Image-Generator
Or if you know the specific files you want to work with, copy them separately:
xet cp xet://XetHub/Text-to-Image-Generator/main Text-to-Image-Generator/
If you want to customize your app, follow the local setup instructions below and develop away. Once you're done, copy your changed files back to the repository.
xet cp <files> xet://<your username>/Text-to-Image-Generator/main -m "Some updates"
Then launch your app through the Capsules tab, changing the App Settings to set your OctoAI credentials (OCTOAI_TOKEN
, OCTOAI_PUBLIC_ENDPOINT
) as secrets prior to deployment.
Working with Git-Xet
Do a lazy clone of the repository, and materialize the placeholder images:
git xet clone --no-smudge https://xethub.com/<your username>/Text-to-Image-Generator.git
cd Text-to-Image-Generator
git xet checkout placeholders/
If you want to customize your app, follow the local setup instructions below and develop away. Once you're done, Git commit and push to update the repository.
Then launch your app through the Capsules tab, changing the App Settings to set your OctoAI credentials (OCTOAI_TOKEN
, OCTOAI_PUBLIC_ENDPOINT
) as secrets prior to deployment.
Local development setup
This app was developed with Python 3.9. Start by setting up your Python environment:
# create and activate a virtual environment
python -m venv venv
source venv/bin/activate
# install dependencies
pip install -r requirements.txt
Environment variables and configuration
We use OctoAI Compute for image generation. Sign up for an account and set these environment variables:
OCTOAI_TOKEN
: Create your access tokenOCTOAI_PUBLIC_ENDPOINT
: Use an OctoAI inference endpoint. Bring your own, or app uses the text2img path on the endpoint used for OctoAI's Stable Diffusion 1.5 template.https://stable-diffusion-demo-kk0powt97tmb.octoai.cloud/text2img
You can set these variables through the command line:
export OCTOAI_TOKEN=<token>
export OCTOAI_PUBLIC_ENDPOINT=<endpoint>
Or by creating a .env file
with the following:
OCTOAI_TOKEN=<token>
OCTOAI_PUBLIC_ENDPOINT=<endpoint>
This app also requires XetHub environment variables to write back to the project. Export the following:
XET_USER_NAME=
XET_USER_TOKEN=
XET_USER_EMAIL=
File List | Total items: 7 | ||
---|---|---|---|
Name | Last Commit | Size | Last Modified |
images | |||
placeholders | |||
.gitattributes | |||
README.md | |||
app.py | |||
config.py | |||
requirements.txt |