File size: 3,726 Bytes
f6c0317 |
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 |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "T4",
"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": [
"<a href=\"https://colab.research.google.com/github/monsterhunters/Stable-Diffusion/blob/main/FaceFusion.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"#FaceFusion\n",
"<a href>https://github.com/facefusion/facefusion</a>"
],
"metadata": {
"id": "NBTB4mTYU4D_"
}
},
{
"cell_type": "code",
"source": [
"#@title **FaceFusion**\n",
"#@markdown - Install Dependencies\n",
"from IPython.utils import capture\n",
"import os\n",
"from IPython.display import clear_output, display, HTML\n",
"\n",
"\n",
"print('Getting Info...')\n",
"with capture.capture_output() as cap:\n",
" !wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb\n",
" !dpkg -i cloudflared-linux-amd64.deb\n",
" !apt-get install -f\n",
" !cloudflared --version\n",
" !mv /usr/local/bin/cloudflared /usr/local/bin/wex\n",
" !wget https://raw.githubusercontent.com/monsterhunters/Stable-Diffusion/main/face.py\n",
" !python face.py\n",
" %cd face\n",
"\n",
"#!pip install -r requirements.txt\n",
"!python install.py --torch cuda-12.1 --onnxruntime cuda-12.1 --skip-venv\n",
"\n",
"clear_output()\n",
"print('Finish installation')"
],
"metadata": {
"cellView": "form",
"id": "5hvomv-yS0eq"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"#@title **RUN**\n",
"#@markdown - Run Setup\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
"import urllib.request\n",
"\n",
"def iframe_thread(port):\n",
" while True:\n",
" time.sleep(0.5)\n",
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex(('127.0.0.1', port))\n",
" if result == 0:\n",
" break\n",
" sock.close()\n",
" print(\"\\nUI finished loading, trying to launch (if it gets stuck here is having issues)\\n\")\n",
"\n",
" p = subprocess.Popen([\"wex\", \"tunnel\", \"--url\", \"http://127.0.0.1:{}\".format(port)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
" for line in p.stderr:\n",
" l = line.decode()\n",
" if \"trycloudflare.com \" in l:\n",
" print(\"This is the URL to access UI:\", l[l.find(\"http\"):], end='')\n",
" #print(l, end='')\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(7860,)).start()\n",
"\n",
"!python run.py\n",
"#@markdown <center><h6>Colab by Codemaster</h6></center>"
],
"metadata": {
"cellView": "form",
"id": "8DzKJnfZqYPA"
},
"execution_count": null,
"outputs": []
}
]
} |