{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "private_outputs": true, "provenance": [], "authorship_tag": "ABX9TyPp9/Q8FYO0+vyv1rl1+Hkj", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "6jzUVWNxKZl4" }, "outputs": [], "source": [ "import os\n", "source_checkpoints = \"/content/ComfyUI/models/checkpoints\"\n", "target_checkpoints = \"/content/drive/MyDrive/ONECLICK/model\"\n", "source_loras = \"/content/ComfyUI/models/loras\"\n", "target_loras = \"/content/drive/MyDrive/ONECLICK/lora\"\n", "source_vae = \"/content/ComfyUI/models/vae\"\n", "target_vae = \"/content/drive/MyDrive/ONECLICK/vae\"\n", "\n", "os.makedirs(target_checkpoints, exist_ok=True)\n", "os.makedirs(target_loras, exist_ok=True)\n", "os.makedirs(target_vae, exist_ok=True)\n", "\n", "!ln -sf \"{target_checkpoints}\" \"{source_checkpoints}\"\n", "!ln -sf \"{target_loras}\" \"{source_loras}\"\n", "!ln -sf \"{target_vae}\" \"{source_vae}\"\n", "\n", "#출력물 경로 관련\n", "import shutil\n", "\n", "def delete_output_folder_if_file_exists():\n", " \"\"\"\n", " /content/ComfyUI/output 폴더 내부에 _output_images_will_be_put_here 파일이 있는 경우 폴더를 삭제합니다.\n", " 파일이 없는 경우 폴더를 유지합니다.\n", " \"\"\"\n", " folder_path = \"/content/ComfyUI/output\"\n", " file_path = os.path.join(folder_path, \"_output_images_will_be_put_here\")\n", "\n", " if os.path.exists(file_path):\n", " shutil.rmtree(folder_path, ignore_errors=True)\n", " print(f\"{folder_path} 폴더를 삭제했습니다. (_output_images_will_be_put_here 파일이 존재합니다.)\")\n", " else:\n", " print(f\"{folder_path} 폴더를 유지합니다. (_output_images_will_be_put_here 파일이 존재하지 않습니다.)\")\n", "\n", "# 함수 호출\n", "delete_output_folder_if_file_exists()\n", "\n", "\n", "import os\n", "sdpath = \"/content/drive/MyDrive/ONECLICK/\"\n", "\n", "outputspath = sdpath + \"output\"\n", "\n", "\n", "if not os.path.exists(outputspath):\n", " !mkdir -p -v \"{outputspath}\"\n", "\n", "link_path = \"/content/ComfyUI/output\"\n", "if not os.path.exists(link_path) and not os.path.islink(link_path):\n", " !ln -s -v \"{outputspath}\" \"{link_path}\"" ] } ] }