drive_link / comfyui_drive_link.ipynbold
arcacolab's picture
Rename comfyui_drive_link.ipynb to comfyui_drive_link.ipynbold
818c8fb verified
{
"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}\""
]
}
]
}