{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4", "collapsed_sections": [ "UdQ1VHdI8lCf" ], "toc_visible": true, "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "source": [ "# Colab for roop-unleashed - Gradio version\n", "https://github.com/C0untFloyd/roop-unleashed\n" ], "metadata": { "id": "G9BdiCppV6AS" } }, { "cell_type": "markdown", "source": [ "Installing & preparing requirements" ], "metadata": { "id": "0ZYRNb0AWLLW" } }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "t1yPuhdySqCq" }, "outputs": [], "source": [ "!git clone -b gradio --single-branch https://github.com/C0untFloyd/roop-unleashed.git\n", "%cd roop-unleashed\n", "!pip install pip install -r requirements.txt" ] }, { "cell_type": "markdown", "source": [ "Running roop-unleashed with GPU Support" ], "metadata": { "id": "u_4JQiSlV9Fi" } }, { "cell_type": "code", "source": [ "!python run.py --execution-provider cuda" ], "metadata": { "id": "Is6U2huqSzLE" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### Download generated images folder" ], "metadata": { "id": "UdQ1VHdI8lCf" } }, { "cell_type": "code", "source": [ "import shutil\n", "import os\n", "from google.colab import files\n", "\n", "def zip_directory(directory_path, zip_path):\n", " shutil.make_archive(zip_path, 'zip', directory_path)\n", "\n", "# Set the directory path you want to download\n", "directory_path = '/content/roop-unleashed/output'\n", "\n", "# Set the zip file name\n", "zip_filename = 'fake_output.zip'\n", "\n", "# Zip the directory\n", "zip_directory(directory_path, zip_filename)\n", "\n", "# Download the zip file\n", "files.download(zip_filename+'.zip')\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 17 }, "id": "oYjWveAmw10X", "outputId": "5b4c3650-f951-434a-c650-5525a8a70c1e" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "" ], "application/javascript": [ "\n", " async function download(id, filename, size) {\n", " if (!google.colab.kernel.accessAllowed) {\n", " return;\n", " }\n", " const div = document.createElement('div');\n", " const label = document.createElement('label');\n", " label.textContent = `Downloading \"${filename}\": `;\n", " div.appendChild(label);\n", " const progress = document.createElement('progress');\n", " progress.max = size;\n", " div.appendChild(progress);\n", " document.body.appendChild(div);\n", "\n", " const buffers = [];\n", " let downloaded = 0;\n", "\n", " const channel = await google.colab.kernel.comms.open(id);\n", " // Send a message to notify the kernel that we're ready.\n", " channel.send({})\n", "\n", " for await (const message of channel.messages) {\n", " // Send a message to notify the kernel that we're ready.\n", " channel.send({})\n", " if (message.buffers) {\n", " for (const buffer of message.buffers) {\n", " buffers.push(buffer);\n", " downloaded += buffer.byteLength;\n", " progress.value = downloaded;\n", " }\n", " }\n", " }\n", " const blob = new Blob(buffers, {type: 'application/binary'});\n", " const a = document.createElement('a');\n", " a.href = window.URL.createObjectURL(blob);\n", " a.download = filename;\n", " div.appendChild(a);\n", " a.click();\n", " div.remove();\n", " }\n", " " ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "application/javascript": [ "download(\"download_789eab11-93d2-4880-adf3-6aceee0cc5f9\", \"fake_output.zip.zip\", 80125)" ] }, "metadata": {} } ] } ] }