collections_directories_atom.py 401 B

1234567891011121314151617
  1. import os
  2. import gradio as gr
  3. def get_collections():
  4. dirs = os.listdir("collections")
  5. dirs.sort()
  6. def get_collection_path(d):
  7. return os.path.join("collections", d)
  8. return ["outputs", "favorites"] + [
  9. get_collection_path(d) for d in dirs if os.path.isdir(get_collection_path(d))
  10. ]
  11. collections_directories_atom = gr.JSON(visible=False, value=get_collections())