Dabs commited on
Commit
4cb4ee2
1 Parent(s): e9e6fef

add n to quantize

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -2,15 +2,15 @@ import numpy as np
2
 
3
  import gradio as gr
4
 
5
- def quantize(val):
6
- return (np.round(val / 255) * 255).astype(np.uint8)
7
 
8
 
9
- def sepia(input_img):
10
- output_img = list(map(quantize, input_img))
11
  return output_img
12
 
13
 
14
- iface = gr.Interface(sepia, "image", "pil")
15
 
16
  iface.launch()
 
2
 
3
  import gradio as gr
4
 
5
+ def quantize(val, n):
6
+ return (np.round(n * val / 255) * 255).astype(np.uint8)
7
 
8
 
9
+ def sepia(n, input_img):
10
+ output_img = [quantize(val, n) for val in input_img]
11
  return output_img
12
 
13
 
14
+ iface = gr.Interface(sepia, ["number", "image"], "pil")
15
 
16
  iface.launch()