Spaces:
Running
on
Zero
Running
on
Zero
deviceをglobalに直す
Browse files- q +113 -0
- scripts/anime.py +2 -1
- scripts/model.py +0 -1
q
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[33mcommit d7efa60788c2404153113982fe8b07cb980c2cd7[m[33m ([m[1;36mHEAD -> [m[1;32mmain[m[33m, [m[1;31morigin/main[m[33m)[m
|
2 |
+
Author: Yeq6X <[email protected]>
|
3 |
+
Date: Sun Jul 7 16:05:06 2024 +0900
|
4 |
+
|
5 |
+
fix
|
6 |
+
|
7 |
+
[33mcommit b6c9f2e78b94c8ac2c962ff0fdde09f6a6fc093b[m[33m ([m[1;31mnew_space/main[m[33m)[m
|
8 |
+
Author: Yeq6X <[email protected]>
|
9 |
+
Date: Sun Jul 7 14:37:03 2024 +0900
|
10 |
+
|
11 |
+
Dockerfile(redis), model.py(dir), requirements.txt(redis,flask-limiter), app.py(bug fix)
|
12 |
+
|
13 |
+
[33mcommit 90ca682e582d750492b3929edf3dcb55f74c739a[m
|
14 |
+
Author: Yeq6X <[email protected]>
|
15 |
+
Date: Sun Jul 7 12:15:55 2024 +0900
|
16 |
+
|
17 |
+
dos taisaku
|
18 |
+
|
19 |
+
[33mcommit 64567a75ad58e5950612c36633efa6d7178c5fe0[m
|
20 |
+
Author: Yeq6X <[email protected]>
|
21 |
+
Date: Sun Jul 7 11:22:34 2024 +0900
|
22 |
+
|
23 |
+
Dockerfile to cpu
|
24 |
+
|
25 |
+
[33mcommit bd4674a596783d10625ba1bd513a95855b9c7406[m
|
26 |
+
Author: Yeq6X <[email protected]>
|
27 |
+
Date: Sun Jul 7 10:58:31 2024 +0900
|
28 |
+
|
29 |
+
use_local編集
|
30 |
+
|
31 |
+
[33mcommit d9b35ec1346875135a831cc142e68a49462c51a3[m
|
32 |
+
Author: Yeq6X <[email protected]>
|
33 |
+
Date: Sun Jul 7 00:22:41 2024 +0900
|
34 |
+
|
35 |
+
Dockerfile
|
36 |
+
|
37 |
+
[33mcommit 4afd7b9e13992bbdc9f4f15edff10e246ce9f6dd[m
|
38 |
+
Author: Yeq6X <[email protected]>
|
39 |
+
Date: Sat Jul 6 23:41:59 2024 +0900
|
40 |
+
|
41 |
+
Dockerfile
|
42 |
+
|
43 |
+
[33mcommit 2a78754181e890bc05d5703b24251696e24c0e80[m
|
44 |
+
Author: Yeq6X <[email protected]>
|
45 |
+
Date: Sat Jul 6 23:32:22 2024 +0900
|
46 |
+
|
47 |
+
Dockerfile
|
48 |
+
|
49 |
+
[33mcommit 5f87f80cf45ac1f9ead6a3366442bf4ff94df64e[m
|
50 |
+
Author: Yeq6X <[email protected]>
|
51 |
+
Date: Sat Jul 6 23:23:36 2024 +0900
|
52 |
+
|
53 |
+
Dockerfile
|
54 |
+
|
55 |
+
[33mcommit d705298c38843dfffc3201fea345e63f1c46a4b5[m
|
56 |
+
Author: Yeq6X <[email protected]>
|
57 |
+
Date: Sat Jul 6 23:11:56 2024 +0900
|
58 |
+
|
59 |
+
dotenv
|
60 |
+
|
61 |
+
[33mcommit da165f522bb4e01e88871e693fe206ba5e555e45[m
|
62 |
+
Author: Yeq6X <[email protected]>
|
63 |
+
Date: Sat Jul 6 23:03:57 2024 +0900
|
64 |
+
|
65 |
+
renamed: Dockerfile.backend -> Dockerfile
|
66 |
+
|
67 |
+
[33mcommit 7ef1daa3df22974a63a1a1bc4a728cd52fce840c[m[33m ([m[1;31mnew_space/master[m[33m, [m[1;32mmaster[m[33m)[m
|
68 |
+
Author: Yeq6X <[email protected]>
|
69 |
+
Date: Sat Jul 6 22:55:32 2024 +0900
|
70 |
+
|
71 |
+
README.md
|
72 |
+
|
73 |
+
[33mcommit 42a98e30be310706a986ab1aad437ff39e53335a[m
|
74 |
+
Author: Yeq6X <[email protected]>
|
75 |
+
Date: Sat Jul 6 22:44:59 2024 +0900
|
76 |
+
|
77 |
+
README.md
|
78 |
+
|
79 |
+
[33mcommit 3e40bc41313683f81c51df846b6b8446610023bc[m
|
80 |
+
Author: Yeq6X <[email protected]>
|
81 |
+
Date: Sat Jul 6 22:41:39 2024 +0900
|
82 |
+
|
83 |
+
delete .env from commit
|
84 |
+
|
85 |
+
[33mcommit 86c0504a689788ef1e74c890f700546c755b600c[m[33m ([m[1;31morigin/master[m[33m, [m[1;31morigin/HEAD[m[33m)[m
|
86 |
+
Author: Yeq6X <[email protected]>
|
87 |
+
Date: Sat Jul 6 22:05:16 2024 +0900
|
88 |
+
|
89 |
+
modify .gitignore to ignore images/
|
90 |
+
|
91 |
+
[33mcommit 721391fed68569e481bf748ab3a4f41add5026cd[m
|
92 |
+
Author: Yeq6X <[email protected]>
|
93 |
+
Date: Sat Jul 6 21:49:18 2024 +0900
|
94 |
+
|
95 |
+
prepare spaces
|
96 |
+
|
97 |
+
[33mcommit dd5dfc863864f9a9d3e1f1b0667293a0932935cf[m
|
98 |
+
Author: Yeq6X <[email protected]>
|
99 |
+
Date: Sat Jul 6 21:15:34 2024 +0900
|
100 |
+
|
101 |
+
docker fix
|
102 |
+
|
103 |
+
[33mcommit d7a562ed99a39f214b899ca4f1ce5a9cb67c3d3b[m
|
104 |
+
Author: Yeq6X <[email protected]>
|
105 |
+
Date: Sat Jul 6 14:41:18 2024 +0900
|
106 |
+
|
107 |
+
arg flag追加
|
108 |
+
|
109 |
+
[33mcommit c9cc4410190cd2cf27dd50363e735b14c70323ab[m
|
110 |
+
Author: Yeq6X <[email protected]>
|
111 |
+
Date: Sat Jul 6 14:10:09 2024 +0900
|
112 |
+
|
113 |
+
init
|
scripts/anime.py
CHANGED
@@ -15,9 +15,10 @@ from PIL import Image
|
|
15 |
import numpy as np
|
16 |
|
17 |
model = None
|
|
|
18 |
|
19 |
def init_model(use_local=False):
|
20 |
-
global model
|
21 |
model_opt = "default"
|
22 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # issue: nevetherless, use_gpu is False, it still uses GPU
|
23 |
model = create_model(model_opt, use_local).to(device)
|
|
|
15 |
import numpy as np
|
16 |
|
17 |
model = None
|
18 |
+
device = None
|
19 |
|
20 |
def init_model(use_local=False):
|
21 |
+
global model, device
|
22 |
model_opt = "default"
|
23 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # issue: nevetherless, use_gpu is False, it still uses GPU
|
24 |
model = create_model(model_opt, use_local).to(device)
|
scripts/model.py
CHANGED
@@ -155,7 +155,6 @@ def create_model(model, use_local):
|
|
155 |
import os
|
156 |
if model == 'default':
|
157 |
model_path = (lambda filename, subfolder: os.path.join(subfolder, filename) if use_local else download_file(filename, subfolder))("netG.pth", "models/Anime2Sketch")
|
158 |
-
# model_path = ((filename, subfolder) => if (use_local) os.path.join(subfolder, filename) else download_file(filename, subfolder))("netG.pth", "models/Anime2Sketch") // JavaScript
|
159 |
|
160 |
ckpt = torch.load(model_path)
|
161 |
for key in list(ckpt.keys()):
|
|
|
155 |
import os
|
156 |
if model == 'default':
|
157 |
model_path = (lambda filename, subfolder: os.path.join(subfolder, filename) if use_local else download_file(filename, subfolder))("netG.pth", "models/Anime2Sketch")
|
|
|
158 |
|
159 |
ckpt = torch.load(model_path)
|
160 |
for key in list(ckpt.keys()):
|