ChavinloSocialRise
commited on
Commit
•
788ebe0
1
Parent(s):
cd89bfa
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ def convert(input_img, quality=85):
|
|
16 |
|
17 |
return img_base64
|
18 |
|
19 |
-
def send_req(input_img
|
20 |
|
21 |
if type(input_img) is not PIL.Image.Image:
|
22 |
input_img = Image.fromarray(input_img, 'RGB')
|
@@ -24,7 +24,9 @@ def send_req(input_img: PIL.Image.Image):
|
|
24 |
payload = {
|
25 |
"input": {
|
26 |
"image": convert(input_img),
|
27 |
-
"mode": "1"
|
|
|
|
|
28 |
}
|
29 |
}
|
30 |
|
@@ -40,6 +42,6 @@ def send_req(input_img: PIL.Image.Image):
|
|
40 |
|
41 |
return image
|
42 |
|
43 |
-
demo = gr.Interface(send_req, gr.Image(), "image")
|
44 |
if __name__ == "__main__":
|
45 |
demo.launch()
|
|
|
16 |
|
17 |
return img_base64
|
18 |
|
19 |
+
def send_req(input_img, compression, noise):
|
20 |
|
21 |
if type(input_img) is not PIL.Image.Image:
|
22 |
input_img = Image.fromarray(input_img, 'RGB')
|
|
|
24 |
payload = {
|
25 |
"input": {
|
26 |
"image": convert(input_img),
|
27 |
+
"mode": "1",
|
28 |
+
"quality": str(compression),
|
29 |
+
"noise": str(noise)
|
30 |
}
|
31 |
}
|
32 |
|
|
|
42 |
|
43 |
return image
|
44 |
|
45 |
+
demo = gr.Interface(send_req, [gr.Image(), gr.slider(0, 100, label="Compression", step=1), gr.slider(0, 100, label="Noise", step=1)], "image")
|
46 |
if __name__ == "__main__":
|
47 |
demo.launch()
|