1
0
Fork 0

Preserve generated Stable Diffusion images with comments and metadata. Duplicate this repository to store your generated images in your own account, and customize to use your own code, tokens, and endpoints.

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.

quentin

Try it for yourself

Navigate to the Capsules tab and enter a phrase. Click "Generate images" and if you like what you see, click "Save images" to preserve your creation in our public repository. Give it a shot!

Browse saved images

Click on the images folder icon in your left-hand file browser to see what prompts others have saved, and click each prompt directory to see the image results. Or for a more natural desktop browsing experience, use the purple Access button to copy code to stream this repository, then open the images/ folder with your preferred file browser to explore the various prompts and images that people have saved in the past.

Customize and remix

Want to keep generating images without writing to this public repository? Use Text-to-Image Generator as a starting point for your own GenAI app and customize away!

Setup

Create an account and install Xet tools if you haven't already, then 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.

Our Text-to-Image Generator app uses OctoAI's speedy Stable Diffusion endpoint. To run the app, you'll need to pass in your OctoAI credentials. Set up a free OctoAI account and go to the Settings page to generate an API token.

Export the token as an environment variable, which ensures that you won't accidentally leak your tokens if you share your repository:

export OCTOAI_TOKEN="<your OctoAI API token>"

Now set your preferred OctoAI inference endpoint. Bring your own, or use the text2img path on the endpoint used for OctoAI's Stable Diffusion 1.5 template as a default:

export OCTOAI_PUBLIC_ENDPOINT="https://stable-diffusion-demo-kk0powt97tmb.octoai.cloud/text2img"

Develop

If all you want to do is to run the duplicated capsule privately to save your own generated images, skip directly to the launch and share instructions. Otherwise, follow this section to 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/

This app was developed with Python 3.9. Set 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

Now you're ready for development! Use your preferred tools to iterate from your desktop.

Once you're happy with your code, copy your changed files back to the remote repository.

xet cp <files> xet://<your username>/Text-to-Image-Generator/main -m "Some updates"
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/

Duplicating a repository makes a copy of everything, so this may also be a good time to git rm any files from the original that you may not care about. In this case, removing old prompt directories from the images/ folder will keep your repository lean.

This app was developed with Python 3.9. Set 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

Now you're ready for development! Use your preferred tools to iterate from your desktop.

Once you're happy with your code, git commit and git push to update the remote.

Launch and share

Ready to move from local to the cloud? Capsules make it easy to deploy Python apps on XetHub.

Once your project is ready, go to the Capsules tab and click Change under the App Settings box. This will bring up a Settings page where you can add your OctoAI API token and endpoint as Secrets, where the keys are OCTOAI_TOKEN and OCTOAI_PUBLIC_ENDPOINT. To print these values back to the screen, run:

printenv OCTOAI_TOKEN
printenv OCTOAI_PUBLIC_ENDPOINT

To write images back to your project, this app also requires your XetHub credentials. Add the following Secrets as well:

XET_USER_NAME
XET_USER_TOKEN
XET_USER_EMAIL

Click Update Settings and launch your capsule. You can easily share capsules in public repositories with others with their URLs or by clicking Share Capsule under the branch dropdown menu. To add others to a private repository, add a collaborator.

Feedback

Let us know what you think of this repository. What's missing or needs improvement? File an issue or reach out directly to share your thoughts. Thanks for being part of our community!

File List Total items: 7
Name Last Commit Size Last Modified
images Write catshot_cats 8 months ago
placeholders copy placeholders to xet://XetHub/Text-to-Image-Generator/main/placeholders 9 months ago
.gitattributes Initial commit 79 B 9 months ago
README.md Update README 5.7 KiB 8 months ago
app.py copy app.py to xet://XetHub/Text-to-Image-Generator/main 7.2 KiB 9 months ago
config.py copy *.py to xet://XetHub/Text-to-Image-Generator/main 1019 B 9 months ago
requirements.txt copy requirements.txt to xet://XetHub/Text-to-Image-Generator/main 250 B 9 months ago

About

Preserve generated Stable Diffusion images with comments and metadata. Duplicate this repository to store your generated images in your own account, and customize to use your own code, tokens, and endpoints.

Repository Size

Loading repo size...

Commits 33 commits

File Types