File size: 5,460 Bytes
0a8c924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405df1c
0a8c924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405df1c
0a8c924
 
 
 
 
 
 
 
 
405df1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a8c924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405df1c
0a8c924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "machine_shape": "hm",
      "gpuType": "L4"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "---\n",
        "\n",
        "πŸ“Œ **This notebook has been updated [here](https://github.com/jhj0517/MusePose-WebUI)!**\n",
        "\n",
        "πŸ–‹ **Author**: [jhj0517](https://github.com/jhj0517/MusePose-WebUI/blob/main/notebook/musepose_webui.ipynb)\n",
        "\n",
        "😎 **Support the Project**:\n",
        "\n",
        "If you find this project useful, please consider supporting it:\n",
        "\n",
        "<a href=\"https://ko-fi.com/A0A7JSQRJ\" target=\"_blank\">\n",
        "    <img src=\"https://storage.ko-fi.com/cdn/kofi2.png?v=3\" alt=\"Buy Me a Coffee at ko-fi.com\" height=\"36\">\n",
        "</a>\n",
        "\n",
        "---"
      ],
      "metadata": {
        "id": "zW0EANufPvGU"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "cellView": "form",
        "id": "cX7SwywlzrS4"
      },
      "outputs": [],
      "source": [
        "#@title #Installation\n",
        "#@markdown This will install dependencies for musepose webui. Ignore \"RESTART SESSION\" warning if it appears\n",
        "\n",
        "!git clone https://github.com/jhj0517/MusePose-WebUI.git\n",
        "%cd MusePose-WebUI\n",
        "!pip install -r requirements.txt\n"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "#@title #Mount Google Drive\n",
        "#@markdown Mount Your Google Drive for your model & output paths.\n",
        "\n",
        "# Mount Google Drive\n",
        "from google.colab import drive\n",
        "import os\n",
        "drive.mount('/content/drive')"
      ],
      "metadata": {
        "cellView": "form",
        "id": "IbkdctzO0S2n"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title # Enter Your Paths on Google Drive\n",
        "#@markdown Enter your models & output directory paths on your google drive.\n",
        "\n",
        "#@markdown  Remove these default values below and enter yours.\n",
        "\n",
        "MusePose_Model_Path = '/content/drive/MyDrive/MusePose/pretrained_weights' # @param {type:\"string\"}\n",
        "Output_Dir = '/content/drive/MyDrive/MusePose/output_folder'  # @param {type:\"string\"}\n",
        "\n",
        "#@markdown You should prepare folder like `Your_MusePose_Models` folder with the following structure on your Google Drive:\n",
        "#@markdown ```\n",
        "#@markdown ./Your_MusePose_Models/\n",
        "#@markdown |-- MusePose\n",
        "#@markdown |   |-- denoising_unet.pth\n",
        "#@markdown |   |-- motion_module.pth\n",
        "#@markdown |   |-- pose_guider.pth\n",
        "#@markdown |   β””-- reference_unet.pth\n",
        "#@markdown |-- dwpose\n",
        "#@markdown |   |-- dw-ll_ucoco_384.pth\n",
        "#@markdown |   └── yolox_l_8x8_300e_coco.pth\n",
        "#@markdown |-- sd-image-variations-diffusers\n",
        "#@markdown |   └── unet\n",
        "#@markdown |       |-- config.json\n",
        "#@markdown |       β””-- diffusion_pytorch_model.bin\n",
        "#@markdown |-- image_encoder\n",
        "#@markdown |   |-- config.json\n",
        "#@markdown |   β””-- pytorch_model.bin\n",
        "#@markdown β””-- sd-vae-ft-mse\n",
        "#@markdown     |-- config.json\n",
        "#@markdown     β””-- diffusion_pytorch_model.bin\n",
        "#@markdown ```\n",
        "\n",
        "#@markdown You can download weigths here: [ReadMe](https://github.com/TMElyralab/MusePose?tab=readme-ov-file#download-weights)\n",
        "\n",
        "\n",
        "\n",
        "# Symlink model path with google drive and local\n",
        "local_model_path = '/content/MusePose-WebUI/pretrained_weights'\n",
        "os.makedirs(local_model_path, exist_ok=True)\n",
        "\n",
        "for item in os.listdir(MusePose_Model_Path):\n",
        "    item_path = os.path.join(MusePose_Model_Path, item)\n",
        "    symlink_path = os.path.join(local_model_path, item)\n",
        "    os.symlink(item_path, symlink_path)\n",
        "!ls \"$local_model_path\"\n",
        "\n",
        "# Symlink output path with google drive and local\n",
        "local_output_path = '/content/MusePose-WebUI/outputs'\n",
        "os.makedirs(local_output_path, exist_ok=True)\n",
        "\n",
        "if os.path.exists(local_output_path):\n",
        "    !rm -r \"$local_output_path\"\n",
        "\n",
        "os.symlink(Output_Dir, local_output_path)\n",
        "!ls \"$local_output_path\""
      ],
      "metadata": {
        "cellView": "form",
        "id": "FILfLli5MdRk"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@title # Run Web UI\n",
        "#@markdown Now you can run the MusePose webui, Use public URL that is displayed\n",
        "\n",
        "!python app.py --share"
      ],
      "metadata": {
        "id": "OXoOcH7n05lo",
        "cellView": "form"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}