LucaVivona commited on
Commit
c5eb9fc
1 Parent(s): 23dce1e

update ⚒️

Browse files
Files changed (1) hide show
  1. backend/src/example/examples.py +0 -43
backend/src/example/examples.py CHANGED
@@ -7,19 +7,11 @@ import torch
7
  from torch import nn
8
  import numpy as np
9
  import PIL
10
- <<<<<<< HEAD
11
 
12
  sys.path.insert(0, "../resources")
13
  from resources.module import GradioModule, register
14
 
15
 
16
- =======
17
-
18
- sys.path.insert(0, "../resources")
19
- from resources.module import GradioModule, register
20
-
21
- """
22
- >>>>>>> origin/main
23
  @GradioModule
24
  class Pictionary:
25
 
@@ -111,41 +103,6 @@ class FSD:
111
  carr = np.array(pixels / np.max(pixels, axis=(0, 1)) * 255, dtype=np.uint8)
112
  return [PIL.Image.fromarray(carr), self.palette_reduce(img, nc) ]
113
 
114
- <<<<<<< HEAD
115
- =======
116
- @register(inputs=[gr.Image(), gr.Image(), gr.Slider(0.00, 16)], outputs=gr.Gallery())
117
- def examples(self, img, img2, nc, ) -> 'list[PIL.Image.Image]':
118
- pixels = np.array(img, dtype=float) / 255
119
- new_height, new_width, _ = img.shape
120
- for row in range(new_height):
121
- for col in range(new_width):
122
- old_val = pixels[row, col].copy()
123
- new_val = self.get_new_val(old_val, nc)
124
- pixels[row, col] = new_val
125
- err = old_val - new_val
126
- if col < new_width - 1:
127
- pixels[row, col + 1] += err * 7 / 16
128
- if row < new_height - 1:
129
- if col > 0:
130
- pixels[row + 1, col - 1] += err * 3 / 16
131
- pixels[row + 1, col] += err * 5 / 16
132
- if col < new_width - 1:
133
- pixels[row + 1, col + 1] += err * 1 / 16
134
- carr = np.array(pixels / np.max(pixels, axis=(0, 1)) * 255, dtype=np.uint8)
135
- return [PIL.Image.fromarray(carr), self.palette_reduce(img, nc) ]
136
-
137
-
138
- @GradioModule
139
- class C:
140
-
141
- def Hello(self):
142
- return "Hello"
143
-
144
- @register(inputs="text", outputs="text")
145
- def Greeting(self, name):
146
- return self.Hello() + " " + name
147
-
148
- >>>>>>> origin/main
149
  @GradioModule
150
  class stock_forecast:
151
 
 
7
  from torch import nn
8
  import numpy as np
9
  import PIL
 
10
 
11
  sys.path.insert(0, "../resources")
12
  from resources.module import GradioModule, register
13
 
14
 
 
 
 
 
 
 
 
15
  @GradioModule
16
  class Pictionary:
17
 
 
103
  carr = np.array(pixels / np.max(pixels, axis=(0, 1)) * 255, dtype=np.uint8)
104
  return [PIL.Image.fromarray(carr), self.palette_reduce(img, nc) ]
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  @GradioModule
107
  class stock_forecast:
108