Update app.py
Browse files
app.py
CHANGED
@@ -122,14 +122,21 @@ def sepia(input_img):
|
|
122 |
return fig
|
123 |
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
|
|
|
|
|
126 |
|
|
|
|
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
outputs=['plot'],
|
131 |
-
examples=["side-1.jpg", "side-2.jpg", "side-3.jpg", "side-4.jpg"],
|
132 |
-
allow_flagging='never')
|
133 |
-
|
134 |
|
|
|
135 |
demo.launch()
|
|
|
|
122 |
return fig
|
123 |
|
124 |
|
125 |
+
class TensorFlowImageInput(gr.Component):
|
126 |
+
def __init__(self, shape=(400, 600)):
|
127 |
+
super().__init__()
|
128 |
+
self.image = None
|
129 |
+
self.shape = shape
|
130 |
|
131 |
+
def render(self):
|
132 |
+
return gr.File(label="이미지", accept=".jpg,.png", capture_file=True)
|
133 |
|
134 |
+
def update(self, value):
|
135 |
+
self.image = tf.image.decode_jpeg(value)
|
136 |
|
137 |
+
def get_value(self):
|
138 |
+
return self.image
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
demo = gr.Interface(fn=sepia, inputs=[TensorFlowImageInput(shape=(400, 600))], outputs=["plot"])
|
141 |
demo.launch()
|
142 |
+
|