Qi28 commited on
Commit
833b7f2
·
verified ·
1 Parent(s): f63f482

Upload server.ipynb

Browse files
Files changed (1) hide show
  1. server.ipynb +89 -0
server.ipynb ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "02bc524b-76ce-45ee-a3c2-56ce6fd9ebc8",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "\u001b[35m[\u001b[0m#23908a 2.7GiB/6.4GiB\u001b[36m(41%)\u001b[0m CN:16 DL:\u001b[32m5.7MiB\u001b[0m ETA:\u001b[33m11m12s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mSD未启动3\n",
14
+ " *** Download Progress Summary as of Sun Nov 24 23:29:21 2024 *** m11m3s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m\n",
15
+ "===============================================================================\n",
16
+ "[#23908a 2.7GiB/6.4GiB(42%) CN:16 DL:5.6MiB ETA:11m21s]\n",
17
+ "FILE: /tmp/code/sd/stable-diffusion-webui/models/Stable-diffusion/动漫-NoobAI-XL_Epsilon-pred.1.0-Version.safetensors\n",
18
+ "-------------------------------------------------------------------------------\n",
19
+ "\n",
20
+ "\u001b[35m[\u001b[0m#23908a 2.7GiB/6.4GiB\u001b[36m(42%)\u001b[0m CN:16 DL:\u001b[32m5.9MiB\u001b[0m ETA:\u001b[33m10m43s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mSD未启动3\n",
21
+ "\u001b[35m[\u001b[0m#23908a 2.7GiB/6.4GiB\u001b[36m(42%)\u001b[0m CN:16 DL:\u001b[32m5.6MiB\u001b[0m ETA:\u001b[33m11m13s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mSD未启动3\n",
22
+ "\u001b[35m[\u001b[0m#23908a 2.7GiB/6.4GiB\u001b[36m(43%)\u001b[0m CN:16 DL:\u001b[32m5.7MiB\u001b[0m ETA:\u001b[33m10m53s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mSD未启动3\n",
23
+ " *** Download Progress Summary as of Sun Nov 24 23:29:37 2024 *** m10m19s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m\n",
24
+ "===============================================================================\n",
25
+ "[#23908a 2.8GiB/6.4GiB(43%) CN:16 DL:5.9MiB ETA:10m24s]\n",
26
+ "FILE: /tmp/code/sd/stable-diffusion-webui/models/Stable-diffusion/动漫-NoobAI-XL_Epsilon-pred.1.0-Version.safetensors\n",
27
+ "-------------------------------------------------------------------------------\n",
28
+ "\n",
29
+ "\u001b[35m[\u001b[0m#23908a 2.8GiB/6.4GiB\u001b[36m(43%)\u001b[0m CN:16 DL:\u001b[32m5.9MiB\u001b[0m ETA:\u001b[33m10m26s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mSD未启动3\n",
30
+ "\u001b[35m[\u001b[0m#23908a 2.8GiB/6.4GiB\u001b[36m(43%)\u001b[0m CN:16 DL:\u001b[32m5.7MiB\u001b[0m ETA:\u001b[33m10m51s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m"
31
+ ]
32
+ }
33
+ ],
34
+ "source": [
35
+ "import time\n",
36
+ "from IPython.display import clear_output\n",
37
+ "import os\n",
38
+ "import threading\n",
39
+ "server_lock = threading.Lock()\n",
40
+ "def server():\n",
41
+ " while True:\n",
42
+ " with server_lock:\n",
43
+ " !mr -r /tmp/code/main.py\n",
44
+ " !wget -O /tmp/code/main.py 'https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/main.py'\n",
45
+ " !python /tmp/code/main.py\n",
46
+ " time.sleep(600)\n",
47
+ "\n",
48
+ "def clear_output_periodically():\n",
49
+ " while True:\n",
50
+ " clear_output()\n",
51
+ " time.sleep(30)\n",
52
+ "threading.Thread(target=server, daemon=True).start()\n",
53
+ "!rm /tmp/code/server.py\n",
54
+ "!wget -O /tmp/code/server.py https://hf-mirror.com/datasets/Qi28/SD_QZ/resolve/main/server.py\n",
55
+ "threading.Thread(target=clear_output_periodically, daemon=True).start()\n",
56
+ "!python /tmp/code/server.py"
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": null,
62
+ "id": "84d9ec6d-c37b-4f34-8b55-f5622c335dfd",
63
+ "metadata": {},
64
+ "outputs": [],
65
+ "source": []
66
+ }
67
+ ],
68
+ "metadata": {
69
+ "kernelspec": {
70
+ "display_name": "Python 3 (ipykernel)",
71
+ "language": "python",
72
+ "name": "python3"
73
+ },
74
+ "language_info": {
75
+ "codemirror_mode": {
76
+ "name": "ipython",
77
+ "version": 3
78
+ },
79
+ "file_extension": ".py",
80
+ "mimetype": "text/x-python",
81
+ "name": "python",
82
+ "nbconvert_exporter": "python",
83
+ "pygments_lexer": "ipython3",
84
+ "version": "3.10.12"
85
+ }
86
+ },
87
+ "nbformat": 4,
88
+ "nbformat_minor": 5
89
+ }