yeq6x commited on
Commit
fca9328
1 Parent(s): d7efa60

deviceをglobalに直す

Browse files
Files changed (3) hide show
  1. q +113 -0
  2. scripts/anime.py +2 -1
  3. scripts/model.py +0 -1
q ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ commit d7efa60788c2404153113982fe8b07cb980c2cd7 (HEAD -> main, origin/main)
2
+ Author: Yeq6X <orange.m0912@gmail.com>
3
+ Date: Sun Jul 7 16:05:06 2024 +0900
4
+
5
+ fix
6
+
7
+ commit b6c9f2e78b94c8ac2c962ff0fdde09f6a6fc093b (new_space/main)
8
+ Author: Yeq6X <orange.m0912@gmail.com>
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
+ commit 90ca682e582d750492b3929edf3dcb55f74c739a
14
+ Author: Yeq6X <orange.m0912@gmail.com>
15
+ Date: Sun Jul 7 12:15:55 2024 +0900
16
+
17
+ dos taisaku
18
+
19
+ commit 64567a75ad58e5950612c36633efa6d7178c5fe0
20
+ Author: Yeq6X <orange.m0912@gmail.com>
21
+ Date: Sun Jul 7 11:22:34 2024 +0900
22
+
23
+ Dockerfile to cpu
24
+
25
+ commit bd4674a596783d10625ba1bd513a95855b9c7406
26
+ Author: Yeq6X <orange.m0912@gmail.com>
27
+ Date: Sun Jul 7 10:58:31 2024 +0900
28
+
29
+ use_local編集
30
+
31
+ commit d9b35ec1346875135a831cc142e68a49462c51a3
32
+ Author: Yeq6X <orange.m0912@gmail.com>
33
+ Date: Sun Jul 7 00:22:41 2024 +0900
34
+
35
+ Dockerfile
36
+
37
+ commit 4afd7b9e13992bbdc9f4f15edff10e246ce9f6dd
38
+ Author: Yeq6X <orange.m0912@gmail.com>
39
+ Date: Sat Jul 6 23:41:59 2024 +0900
40
+
41
+ Dockerfile
42
+
43
+ commit 2a78754181e890bc05d5703b24251696e24c0e80
44
+ Author: Yeq6X <orange.m0912@gmail.com>
45
+ Date: Sat Jul 6 23:32:22 2024 +0900
46
+
47
+ Dockerfile
48
+
49
+ commit 5f87f80cf45ac1f9ead6a3366442bf4ff94df64e
50
+ Author: Yeq6X <orange.m0912@gmail.com>
51
+ Date: Sat Jul 6 23:23:36 2024 +0900
52
+
53
+ Dockerfile
54
+
55
+ commit d705298c38843dfffc3201fea345e63f1c46a4b5
56
+ Author: Yeq6X <orange.m0912@gmail.com>
57
+ Date: Sat Jul 6 23:11:56 2024 +0900
58
+
59
+ dotenv
60
+
61
+ commit da165f522bb4e01e88871e693fe206ba5e555e45
62
+ Author: Yeq6X <orange.m0912@gmail.com>
63
+ Date: Sat Jul 6 23:03:57 2024 +0900
64
+
65
+ renamed: Dockerfile.backend -> Dockerfile
66
+
67
+ commit 7ef1daa3df22974a63a1a1bc4a728cd52fce840c (new_space/master, master)
68
+ Author: Yeq6X <orange.m0912@gmail.com>
69
+ Date: Sat Jul 6 22:55:32 2024 +0900
70
+
71
+ README.md
72
+
73
+ commit 42a98e30be310706a986ab1aad437ff39e53335a
74
+ Author: Yeq6X <orange.m0912@gmail.com>
75
+ Date: Sat Jul 6 22:44:59 2024 +0900
76
+
77
+ README.md
78
+
79
+ commit 3e40bc41313683f81c51df846b6b8446610023bc
80
+ Author: Yeq6X <orange.m0912@gmail.com>
81
+ Date: Sat Jul 6 22:41:39 2024 +0900
82
+
83
+ delete .env from commit
84
+
85
+ commit 86c0504a689788ef1e74c890f700546c755b600c (origin/master, origin/HEAD)
86
+ Author: Yeq6X <orange.m0912@gmail.com>
87
+ Date: Sat Jul 6 22:05:16 2024 +0900
88
+
89
+ modify .gitignore to ignore images/
90
+
91
+ commit 721391fed68569e481bf748ab3a4f41add5026cd
92
+ Author: Yeq6X <orange.m0912@gmail.com>
93
+ Date: Sat Jul 6 21:49:18 2024 +0900
94
+
95
+ prepare spaces
96
+
97
+ commit dd5dfc863864f9a9d3e1f1b0667293a0932935cf
98
+ Author: Yeq6X <orange.m0912@gmail.com>
99
+ Date: Sat Jul 6 21:15:34 2024 +0900
100
+
101
+ docker fix
102
+
103
+ commit d7a562ed99a39f214b899ca4f1ce5a9cb67c3d3b
104
+ Author: Yeq6X <orange.m0912@gmail.com>
105
+ Date: Sat Jul 6 14:41:18 2024 +0900
106
+
107
+ arg flag追加
108
+
109
+ commit c9cc4410190cd2cf27dd50363e735b14c70323ab
110
+ Author: Yeq6X <orange.m0912@gmail.com>
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()):