Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,10 +15,13 @@ def tensor_to_image(tensor):
|
|
| 15 |
tensor = tensor[0]
|
| 16 |
return Image.fromarray(tensor)
|
| 17 |
|
| 18 |
-
def load(file_uploader):
|
| 19 |
max_dim = 512
|
| 20 |
image = file_uploader
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
image = tf.image.convert_image_dtype(image, tf.float32)
|
| 23 |
|
| 24 |
shape = tf.cast(tf.shape(image)[:-1], tf.float32)
|
|
@@ -33,7 +36,7 @@ def load(file_uploader):
|
|
| 33 |
|
| 34 |
st.title("Sketch to Real Image Pix2Pix")
|
| 35 |
inp = st.file_uploader("Sketch input")
|
| 36 |
-
style = load('style.jpg')
|
| 37 |
|
| 38 |
if inp is not None:
|
| 39 |
img = load(inp)
|
|
|
|
| 15 |
tensor = tensor[0]
|
| 16 |
return Image.fromarray(tensor)
|
| 17 |
|
| 18 |
+
def load(file_uploader,fst=True):
|
| 19 |
max_dim = 512
|
| 20 |
image = file_uploader
|
| 21 |
+
if fst:
|
| 22 |
+
image = tf.image.decode_image(image.read(), channels=3)
|
| 23 |
+
else:
|
| 24 |
+
image = tf.image.decode_image(image, channels=3)
|
| 25 |
image = tf.image.convert_image_dtype(image, tf.float32)
|
| 26 |
|
| 27 |
shape = tf.cast(tf.shape(image)[:-1], tf.float32)
|
|
|
|
| 36 |
|
| 37 |
st.title("Sketch to Real Image Pix2Pix")
|
| 38 |
inp = st.file_uploader("Sketch input")
|
| 39 |
+
style = load('style.jpg',False)
|
| 40 |
|
| 41 |
if inp is not None:
|
| 42 |
img = load(inp)
|