{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "code", "source": [ "#!pip install https://github.com/karaokenerds/python-audio-separator/releases/download/v0.12.1/onnxruntime_gpu-1.17.0-cp310-cp310-linux_x86_64.whl" ], "metadata": { "id": "WLmnhmI0vy07" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# either download from here and install requ\n", "#!wget https://huggingface.co/waveydaveygravy/swap-mukham/resolve/main/swapm.zip" ], "metadata": { "id": "5b_4n8AuWJko" }, "execution_count": 9, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "dQiXW8_sRLRX" }, "outputs": [], "source": [ "!pip install virtualenv\n", "\n", "!virtualenv swap\n", "\n", "!source /swap/bin/activate\n", "\n", "%cd /content/swap\n", "!git clone https://github.com/G-force78/Swap-Mukham.git\n", "#or !wget from here and move into contents then continue\n", "%cd /content/swap/Swap-Mukham\n", "\n", "!pip install -r requirements.txt\n", "\n", "!pip install https://github.com/karaokenerds/python-audio-separator/releases/download/v0.12.1/onnxruntime_gpu-1.17.0-cp310-cp310-linux_x86_64.whl" ] }, { "cell_type": "code", "source": [ "!wget https://huggingface.co/datasets/OwlMaster/gg2/resolve/main/inswapper_128.onnx -O /content/swap/Swap-Mukham/assets/pretrained_models/inswapper_128.onnx\n", "\n", "!wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth -O /content/swap/Swap-Mukham/assets/pretrained_models/GFPGANv1.4.pth\n", "\n", "!gdown https://drive.google.com/uc?id=154JgKpzCPW82qINcVieuPH3fZ2e0P812 -O /content/swap/Swap-Mukham/assets/pretrained_models/\n", "\n", "!wget https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x2.pth -O /content/swap/Swap-Mukham/assets/pretrained_models/RealESRGAN_x2.pth\n", "\n", "!wget https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth -O /content/swap/Swap-Mukham/assets/pretrained_models/RealESRGAN_x4.pth\n", "\n", "!wget https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x8.pth -O /content/swap/Swap-Mukham/assets/pretrained_models/RealESRGAN_x8.pth\n", "\n", "!wget https://huggingface.co/bluefoxcreation/Codeformer-ONNX/resolve/main/codeformer.onnx -O /content/swap/Swap-Mukham/assets/pretrained_models/codeformer.onnx\n", "\n", "!wget https://huggingface.co/bluefoxcreation/open-nsfw/resolve/main/open-nsfw.onnx -O /content/swap/Swap-Mukham/assets/pretrained_models/open-nsfw.onnx" ], "metadata": { "id": "xJesLPCwRXjW" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Z8BBgh8Byr2n" }, "outputs": [], "source": [ "from google.colab import files\n", "uploaded = files.upload()" ] }, { "cell_type": "code", "source": [ "!python3 /content/swap/Swap-Mukham/app.py --colab --cuda --batch_size 32" ], "metadata": { "id": "X6f46G46ReyW" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": 7, "metadata": { "id": "FaF3RdKdaFa8" }, "outputs": [], "source": [ "#@title Login to HuggingFace 🤗\n", "\n", "#@markdown You need to accept the model license before downloading or using the Stable Diffusion weights. Please, visit the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5), read the license and tick the checkbox if you agree. You have to be a registered user in 🤗 Hugging Face Hub, and you'll also need to use an access token for the code to work.\n", "# https://huggingface.co/settings/tokens\n", "!mkdir -p ~/.huggingface\n", "HUGGINGFACE_TOKEN = \"\" #@param {type:\"string\"}\n", "!echo -n \"{HUGGINGFACE_TOKEN}\" > ~/.huggingface/token" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "aEJZoFQ2YHIb" }, "outputs": [], "source": [ "#@title upload to Huggingface\n", "from huggingface_hub import HfApi\n", "api = HfApi()\n", "api.upload_file(\n", " path_or_fileobj=\"\",\n", " path_in_repo=\"\",\n", " repo_id=\"\",\n", " repo_type=\"model\",\n", ")" ] }, { "cell_type": "code", "source": [ "!zip -r name whateveruwanttozip" ], "metadata": { "id": "fiVq-xqKRfX_" }, "execution_count": null, "outputs": [] } ] }