rnwang commited on
Commit
9514db3
·
1 Parent(s): b319f79

modify license

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -13,6 +13,28 @@
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
  #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  import gradio as gr
17
  import numpy as np
18
  import time
@@ -25,7 +47,7 @@ from pathlib import Path
25
  from torch.utils.data import Dataset
26
  import datetime
27
 
28
-
29
  device = 'cpu'
30
  dtype = torch.float32
31
  generator = torch.load("models/generator.pt")
@@ -45,11 +67,13 @@ class ImageDataset(Dataset):
45
  return len(self.imgs)
46
 
47
 
48
- # quantize model
49
  data_path = Path('data/webcam')
50
  train_image_dd = prepare_data(data_path)
51
  dm = PatchDataModule(train_image_dd, patch_size=2**6,
52
  batch_size=2**3, patch_num=2**6)
 
 
53
  train_loader = dm.train_dataloader()
54
  train_loader_iter = iter(train_loader)
55
  quantized_model = Trainer.quantize(generator, accelerator=None,
 
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
  #
16
+ # MIT License
17
+
18
+ # Copyright (c) 2022 Lorenzo Breschi
19
+
20
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ # of this software and associated documentation files (the "Software"), to deal
22
+ # in the Software without restriction, including without limitation the rights
23
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ # copies of the Software, and to permit persons to whom the Software is
25
+ # furnished to do so, subject to the following conditions:
26
+
27
+ # The above copyright notice and this permission notice shall be included in all
28
+ # copies or substantial portions of the Software.
29
+
30
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ # SOFTWARE.
37
+
38
  import gradio as gr
39
  import numpy as np
40
  import time
 
47
  from torch.utils.data import Dataset
48
  import datetime
49
 
50
+ # below part is adapted from https://github.com/rnwzd/FSPBT-Image-Translation/blob/master/eval.py
51
  device = 'cpu'
52
  dtype = torch.float32
53
  generator = torch.load("models/generator.pt")
 
67
  return len(self.imgs)
68
 
69
 
70
+ # below part is adapted from https://github.com/rnwzd/FSPBT-Image-Translation/blob/master/train.py
71
  data_path = Path('data/webcam')
72
  train_image_dd = prepare_data(data_path)
73
  dm = PatchDataModule(train_image_dd, patch_size=2**6,
74
  batch_size=2**3, patch_num=2**6)
75
+
76
+ # quantize model
77
  train_loader = dm.train_dataloader()
78
  train_loader_iter = iter(train_loader)
79
  quantized_model = Trainer.quantize(generator, accelerator=None,