15
0
Fork 1

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:

  1. Update this repository locally.

    • Using Git-Xet (recommended)

      Run 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/
      
    • Using Xet CLI

      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/
      
  2. 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
    
  3. Update the application with your local code editor. Now is also a good time to remove any extra files in the images/ folder that you may not care about to keep the repository lean.

  4. Once you're happy with your changes, update the remote repository.

    • Using Git-Xet (recommended)

      git add .
      git commit -am "Update with changes"
      git push
      
    • Using Xet CLI

      xet cp <files> xet://<your username>/Text-to-Image-Generator/main -m "Update with changes"
      

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 requires your XetHub credentials. Add these 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, invite 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: 8
Name Last Commit Size Last Modified
images Write realistic_1930s_gangster_chickens_playing_poker_while_smoking_cigars_and_holding_tommy_guns_2024-01-05T0053330000 4 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
.gitignore Updated to StableDiffusion XL 1.0 model 8.7 KiB 4 months ago
README.md Update README 5.3 KiB 7 months ago
app.py Updated to StableDiffusion XL 1.0 model 7.2 KiB 4 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 52 commits

File Types