| { |
| "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": [ |
| "<a href=\"https://colab.research.google.com/github/arcacolab/oneclick/blob/main/comfyui_drive_link.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
| ] |
| }, |
| { |
| "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}\"" |
| ] |
| } |
| ] |
| } |