Sanket commited on
Commit
b94f049
1 Parent(s): 05fa07b
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -122,16 +122,24 @@ def predict(input_img, ver):
122
  source = drawing.split()
123
 
124
  R, G, B = 0, 1, 2
125
- constant = 2.0 # constant by which each pixel is divided
126
 
127
- Red = source[R].point(lambda i: i / constant if i < 200 else i)
128
- Green = source[G].point(lambda i: i / constant if i < 200 else i)
129
- Blue = source[B].point(lambda i: i / constant if i < 200 else i)
130
 
131
  im_output = Image.merge(im_output.mode, (Red, Green, Blue))
132
  return im_output
133
 
134
 
 
 
 
 
 
 
 
 
135
  title = "Image to Line Drawings - Complex and Simple Portraits and Landscapes"
136
  examples = [
137
  ["01.jpg", "Complex Lines"],
 
122
  source = drawing.split()
123
 
124
  R, G, B = 0, 1, 2
125
+ # constant by which each pixel is divided
126
 
127
+ Red = source[R].point(darken_pixel)
128
+ Green = source[G].point(darken_pixel)
129
+ Blue = source[B].point(darken_pixel)
130
 
131
  im_output = Image.merge(im_output.mode, (Red, Green, Blue))
132
  return im_output
133
 
134
 
135
+ def darken_pixel(pixel):
136
+ constant = 2.0
137
+ if pixel < 200:
138
+ return pixel / constant
139
+ else:
140
+ return pixel
141
+
142
+
143
  title = "Image to Line Drawings - Complex and Simple Portraits and Landscapes"
144
  examples = [
145
  ["01.jpg", "Complex Lines"],