bigbossmonster commited on
Commit
f6c0317
·
verified ·
1 Parent(s): e13ad48

Upload folder with Python script

Browse files
Files changed (1) hide show
  1. FaceFusion.ipynb +116 -0
FaceFusion.ipynb ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "gpuType": "T4",
8
+ "include_colab_link": true
9
+ },
10
+ "kernelspec": {
11
+ "name": "python3",
12
+ "display_name": "Python 3"
13
+ },
14
+ "language_info": {
15
+ "name": "python"
16
+ },
17
+ "accelerator": "GPU"
18
+ },
19
+ "cells": [
20
+ {
21
+ "cell_type": "markdown",
22
+ "metadata": {
23
+ "id": "view-in-github",
24
+ "colab_type": "text"
25
+ },
26
+ "source": [
27
+ "<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>"
28
+ ]
29
+ },
30
+ {
31
+ "cell_type": "markdown",
32
+ "source": [
33
+ "#FaceFusion\n",
34
+ "<a href>https://github.com/facefusion/facefusion</a>"
35
+ ],
36
+ "metadata": {
37
+ "id": "NBTB4mTYU4D_"
38
+ }
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "source": [
43
+ "#@title **FaceFusion**\n",
44
+ "#@markdown - Install Dependencies\n",
45
+ "from IPython.utils import capture\n",
46
+ "import os\n",
47
+ "from IPython.display import clear_output, display, HTML\n",
48
+ "\n",
49
+ "\n",
50
+ "print('Getting Info...')\n",
51
+ "with capture.capture_output() as cap:\n",
52
+ " !wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb\n",
53
+ " !dpkg -i cloudflared-linux-amd64.deb\n",
54
+ " !apt-get install -f\n",
55
+ " !cloudflared --version\n",
56
+ " !mv /usr/local/bin/cloudflared /usr/local/bin/wex\n",
57
+ " !wget https://raw.githubusercontent.com/monsterhunters/Stable-Diffusion/main/face.py\n",
58
+ " !python face.py\n",
59
+ " %cd face\n",
60
+ "\n",
61
+ "#!pip install -r requirements.txt\n",
62
+ "!python install.py --torch cuda-12.1 --onnxruntime cuda-12.1 --skip-venv\n",
63
+ "\n",
64
+ "clear_output()\n",
65
+ "print('Finish installation')"
66
+ ],
67
+ "metadata": {
68
+ "cellView": "form",
69
+ "id": "5hvomv-yS0eq"
70
+ },
71
+ "execution_count": null,
72
+ "outputs": []
73
+ },
74
+ {
75
+ "cell_type": "code",
76
+ "source": [
77
+ "#@title **RUN**\n",
78
+ "#@markdown - Run Setup\n",
79
+ "import subprocess\n",
80
+ "import threading\n",
81
+ "import time\n",
82
+ "import socket\n",
83
+ "import urllib.request\n",
84
+ "\n",
85
+ "def iframe_thread(port):\n",
86
+ " while True:\n",
87
+ " time.sleep(0.5)\n",
88
+ " sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
89
+ " result = sock.connect_ex(('127.0.0.1', port))\n",
90
+ " if result == 0:\n",
91
+ " break\n",
92
+ " sock.close()\n",
93
+ " print(\"\\nUI finished loading, trying to launch (if it gets stuck here is having issues)\\n\")\n",
94
+ "\n",
95
+ " p = subprocess.Popen([\"wex\", \"tunnel\", \"--url\", \"http://127.0.0.1:{}\".format(port)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
96
+ " for line in p.stderr:\n",
97
+ " l = line.decode()\n",
98
+ " if \"trycloudflare.com \" in l:\n",
99
+ " print(\"This is the URL to access UI:\", l[l.find(\"http\"):], end='')\n",
100
+ " #print(l, end='')\n",
101
+ "\n",
102
+ "\n",
103
+ "threading.Thread(target=iframe_thread, daemon=True, args=(7860,)).start()\n",
104
+ "\n",
105
+ "!python run.py\n",
106
+ "#@markdown <center><h6>Colab by Codemaster</h6></center>"
107
+ ],
108
+ "metadata": {
109
+ "cellView": "form",
110
+ "id": "8DzKJnfZqYPA"
111
+ },
112
+ "execution_count": null,
113
+ "outputs": []
114
+ }
115
+ ]
116
+ }