[Feat] Add user history

#9
by Wauplin HF staff - opened

(similar PR for the warp-ai/Wuerstchen can be found here)

Live demo of this PR in this Space + check screenshots below

The goal of this PR is to add the possibility for users to store their history. It works using OAuth to authenticate the user and Persistent Storage to store the images. The persistent storage is kept between reboots of the Space and across multiple replicas.

In addition to this PR, a few settings have to be configured:

  • Add a Persistent Storage in the Space settings. 150GB should be enough for now? Worst case scenario, it's possible to increase it to 1TB.
  • Add HISTORY_FOLDER="/data/history" as Space variable

And that should be it!

About the feature itself:

  • if the user is not logged in, the Space works as it is now
  • if the user is logged in, a Gallery will list their past images with the used prompt. At the moment other parameters are not saved with it.
  • if an error happen for any reason, the history gallery stays empty but the rest of the Space still works similarly

User history section as a gallery, at the bottom of the Space
1.

image.png

image.png

Wauplin changed pull request status to open
AP123 changed pull request status to merged

Sign up or log in to comment