Spaces:
Sleeping
Sleeping
Commit
·
e88c58c
1
Parent(s):
21654e8
encoder OK
Browse files
app.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from utils import encoder, decoder
|
| 3 |
|
| 4 |
-
source_img = gr.Image(source="upload", type="filepath", label="init_img
|
| 5 |
encoded_img = gr.Image()
|
| 6 |
|
| 7 |
-
def greet(name):
|
| 8 |
-
return "Hello " + name + "!!"
|
| 9 |
|
| 10 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 11 |
iface = gr.Interface(fn=encoder, inputs=[source_img,
|
| 12 |
-
gr.Slider(label='noise', minimum = 0, maximum = 1, step = .
|
| 13 |
outputs=encoded_img)
|
| 14 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from utils import encoder, decoder
|
| 3 |
|
| 4 |
+
source_img = gr.Image(source="upload", type="filepath", label="init_img")
|
| 5 |
encoded_img = gr.Image()
|
| 6 |
|
|
|
|
|
|
|
| 7 |
|
|
|
|
| 8 |
iface = gr.Interface(fn=encoder, inputs=[source_img,
|
| 9 |
+
gr.Slider(label='noise', minimum = 0.5, maximum = 1, step = .005, value = .95)],
|
| 10 |
outputs=encoded_img)
|
| 11 |
iface.launch()
|
utils.py
CHANGED
|
@@ -34,7 +34,8 @@ def encoder_cp(img,color_points):
|
|
| 34 |
return img2
|
| 35 |
|
| 36 |
def encoder(img,p):
|
| 37 |
-
img = resize(img
|
|
|
|
| 38 |
mask = get_mask(img,p)
|
| 39 |
c_p, n_p = generate_points(mask)
|
| 40 |
return encoder_cp(img, c_p)
|
|
|
|
| 34 |
return img2
|
| 35 |
|
| 36 |
def encoder(img,p):
|
| 37 |
+
#img = resize(VALUE,img)
|
| 38 |
+
img = Image.open(img)
|
| 39 |
mask = get_mask(img,p)
|
| 40 |
c_p, n_p = generate_points(mask)
|
| 41 |
return encoder_cp(img, c_p)
|