save_to_favorites.py 392 B

1234567891011121314
  1. import gradio as gr
  2. import os
  3. import shutil
  4. def save_to_favorites(directory: str):
  5. shutil.copytree(directory, os.path.join("favorites", os.path.basename(directory)))
  6. return gr.Button(value="Saved")
  7. def save_to_collection(directory: str, collection: str):
  8. shutil.copytree(directory, os.path.join(collection, os.path.basename(directory)))
  9. return gr.Dropdown(value="Saved")