forked from facefusion/facefusion
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathfacefusion 2.6.0.ipynb.txt
115 lines (115 loc) · 3.17 KB
/
facefusion 2.6.0.ipynb.txt
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
{
"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",
"execution_count": null,
"metadata": {
"id": "XaqO7feu9sAw"
},
"outputs": [],
"source": [
"from IPython.display import clear_output\n",
"import codecs\n",
"import torch\n",
"\n",
"if torch.cuda.is_available():\n",
" device=\"cuda\"\n",
" !apt-get install nvidia-cuda-toolkit\n",
" print(\"Using GPU\")\n",
"else:\n",
" device=\"cpu\"\n",
" print(\"Using CPU\")\n",
"\n",
"giturl = codecs.decode('uggcf://tvguho.pbz/snprshfvba/snprshfvba.tvg','rot_13')\n",
"gitdir = codecs.decode('snprshfvba','rot_13')\n",
"!git clone {giturl}\n",
"%cd /content/{gitdir}\n",
"!python install.py --onnxruntime cuda-11.8 --skip-conda\n",
"\n",
"clear_output()\n",
"print(\"Installed!\")"
]
},
{
"cell_type": "code",
"source": [
"import codecs\n",
"gitdir = codecs.decode('snprshfvba','rot_13')\n",
"%cd /content/{gitdir}\n",
"\n",
"if device==\"cuda\":\n",
" !python run.py --execution-providers cpu cuda\n",
"else:\n",
" !python run.py --execution-providers cpu"
],
"metadata": {
"id": "996UKUjT-BEu"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!npm install -g localtunnel\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
"import urllib.request\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",
"\n",
" from colorama import Fore, Style\n",
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
" for line in p.stdout:\n",
" print(line.decode(), end='')\n",
"threading.Thread (target=iframe_thread, daemon=True, args=(7860,)).start()\n",
"\n",
"\n",
"\n",
"\n",
"!python run.py"
],
"metadata": {
"id": "WyELkRnM9EK1"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!pip install colorama"
],
"metadata": {
"id": "AdKoCHKA9NpU"
},
"execution_count": null,
"outputs": []
}
]
}