Spaces:
Runtime error
Runtime error
title and small corrections
Browse files
app.py
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
import numpy as np
|
2 |
-
|
3 |
import gradio as gr
|
4 |
|
5 |
def quantize(val, factor):
|
6 |
quantized = (np.round(factor * np.array(val / 255)) * (255 / factor)).astype(int)
|
7 |
-
# print(val / 255, factor, factor * np.array(val / 255))
|
8 |
return quantized
|
9 |
|
10 |
|
11 |
-
def
|
12 |
img_arr = np.asarray(input_img)
|
13 |
new_img = np.copy(img_arr)
|
14 |
|
@@ -26,6 +24,11 @@ def sepia(factor, input_img):
|
|
26 |
return new_img
|
27 |
|
28 |
|
29 |
-
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
iface.launch()
|
|
|
1 |
import numpy as np
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
def quantize(val, factor):
|
5 |
quantized = (np.round(factor * np.array(val / 255)) * (255 / factor)).astype(int)
|
|
|
6 |
return quantized
|
7 |
|
8 |
|
9 |
+
def fsd(factor, input_img):
|
10 |
img_arr = np.asarray(input_img)
|
11 |
new_img = np.copy(img_arr)
|
12 |
|
|
|
24 |
return new_img
|
25 |
|
26 |
|
27 |
+
iface = gr.Interface(fsd,
|
28 |
+
[gr.inputs.Slider(1, 10, 1),
|
29 |
+
"image"],
|
30 |
+
"pil",
|
31 |
+
title="Floyd–Steinberg dithering",
|
32 |
+
description="Floyd–Steinberg dithering algorithm")
|
33 |
|
34 |
iface.launch()
|