Vanwise commited on
Commit
a7a7051
·
1 Parent(s): 1be9f55

Upload 3 files

Browse files
voltaml/_main.ipynb ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import os\n",
10
+ "!wget https://huggingface.co/Vanwise/sd-colab/resolve/main/libtcmalloc_minimal.so.4\n",
11
+ "os.environ['LD_PRELOAD'] = '/content/libtcmalloc_minimal.so.4'\n",
12
+ "from IPython.display import clear_output\n",
13
+ "!git clone https://github.com/Van-wise/voltaML-sd\n",
14
+ "!pip install pyngrok\n",
15
+ "ngrok.set_auth_token(ngrok_token)\n",
16
+ "!python main.py --install-only\n",
17
+ "clear_output()\n",
18
+ "\n"
19
+ ]
20
+ }
21
+ ],
22
+ "metadata": {
23
+ "language_info": {
24
+ "name": "python"
25
+ }
26
+ },
27
+ "nbformat": 4,
28
+ "nbformat_minor": 2
29
+ }
voltaml/_start1.ipynb ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "##### 启动voltaml (有输出日志..)"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "import multiprocessing\n",
17
+ "import time\n",
18
+ "import subprocess\n",
19
+ "\n",
20
+ "use_ngrok = True\n",
21
+ "use_cloudflare = True\n",
22
+ "\n",
23
+ "def start_tunnel():\n",
24
+ " if use_ngrok:\n",
25
+ " from pyngrok import ngrok\n",
26
+ " ngrok_tunnel = ngrok.connect(5003, \"http\")\n",
27
+ " print(\"ngrok_tunnel:\", ngrok_tunnel)\n",
28
+ " if use_cloudflare:\n",
29
+ " from pycloudflared import try_cloudflare\n",
30
+ " cloudflare_url = try_cloudflare(5003, verbose=False)\n",
31
+ " print(\"cloudflare_tunnel:\", cloudflare_url)\n",
32
+ "\n",
33
+ "def voltaML_start():\n",
34
+ " print(\"启动alist...\")\n",
35
+ " process = subprocess.Popen([\"python\", \"main.py\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
36
+ " for line in process.stdout:\n",
37
+ " output = line.decode().strip()\n",
38
+ " if output:\n",
39
+ " print(output)\n",
40
+ "\n",
41
+ "voltaML_process = multiprocessing.Process(target=voltaML_start)\n",
42
+ "voltaML_process.start()\n",
43
+ "time.sleep(3)\n",
44
+ "\n",
45
+ "start_tunnel()\n",
46
+ "\n",
47
+ "# 提示用户如何暂停代码的执行\n",
48
+ "print(\"代码正在运行中。要手动暂停代码的执行,请点击左侧的暂停按钮。\")\n",
49
+ "\n",
50
+ "# 检查voltaML_process进程是否仍在运行\n",
51
+ "while voltaML_process.is_alive():\n",
52
+ " time.sleep(1)\n",
53
+ "\n",
54
+ "print(\"主程序继续执行...\")"
55
+ ]
56
+ }
57
+ ],
58
+ "metadata": {
59
+ "language_info": {
60
+ "name": "python"
61
+ }
62
+ },
63
+ "nbformat": 4,
64
+ "nbformat_minor": 2
65
+ }
voltaml/_start2.ipynb ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "##### 后台运行"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "import multiprocessing\n",
17
+ "import time\n",
18
+ "\n",
19
+ "use_ngrok = True\n",
20
+ "use_cloudflare = True\n",
21
+ "\n",
22
+ "def start_tunnle():\n",
23
+ " if use_ngrok:\n",
24
+ " from pyngrok import ngrok\n",
25
+ " ngrok_tunnel = ngrok.connect(5003, \"http\")\n",
26
+ " print(\"ngrok_tunnel:\", ngrok_tunnel)\n",
27
+ " if use_cloudflare:\n",
28
+ " from pycloudflared import try_cloudflare\n",
29
+ " cloudflare_url = try_cloudflare(5003, verbose=False)\n",
30
+ " print(\"cloudflare_tunnel:\", cloudflare_url)\n",
31
+ "\n",
32
+ "def voltaML_start():\n",
33
+ " print(\"启动alist...\")\n",
34
+ " subprocess.run([\"python\", \"main.py\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
35
+ "\n",
36
+ "# 在单独的进程中启动voltaML_start函数\n",
37
+ "voltaML_process = multiprocessing.Process(target=voltaML_start)\n",
38
+ "voltaML_process.start()\n",
39
+ "\n",
40
+ "# 等待3秒\n",
41
+ "time.sleep(3)\n",
42
+ "\n",
43
+ "# 运行start_tunnle函数\n",
44
+ "start_tunnle()\n",
45
+ "\n",
46
+ "# 要停止voltaML_start进程,请中断笔记本单元格的执行或手动终止该进程。\n",
47
+ "print(\"主程序后台执行中...\")"
48
+ ]
49
+ }
50
+ ],
51
+ "metadata": {
52
+ "language_info": {
53
+ "name": "python"
54
+ }
55
+ },
56
+ "nbformat": 4,
57
+ "nbformat_minor": 2
58
+ }