Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
from texture_transfer import create_image_tile, create_layover, create_image_cutout, paste_image
|
|
|
|
| 4 |
|
| 5 |
st.title("Texture Correction App")
|
| 6 |
|
|
@@ -21,6 +22,13 @@ with product:
|
|
| 21 |
st.header("Input product texture patch")
|
| 22 |
product_image = st.file_uploader("Patch of the Garment(Cut out an area from the garment)",
|
| 23 |
type=["png", "jpg", "jpeg"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
if product_image:
|
| 25 |
st.image(product_image)
|
| 26 |
|
|
@@ -39,7 +47,12 @@ with texture_correct:
|
|
| 39 |
product_image_dim = product_image_n.size
|
| 40 |
x_dim = product_image_dim[0]
|
| 41 |
y_dim = product_image_dim[1]
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
overlay = create_layover(generated_image, 'tiled_image.png', opacity)
|
| 44 |
create_image_cutout('lay_over_image.png', gen_image_mask)
|
| 45 |
paste_image(generated_image, 'cut_out_image.png', gen_image_mask)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
from texture_transfer import create_image_tile, create_layover, create_image_cutout, paste_image
|
| 4 |
+
from create_print_layover import create_image_with_feather_tile, control_texture
|
| 5 |
|
| 6 |
st.title("Texture Correction App")
|
| 7 |
|
|
|
|
| 22 |
st.header("Input product texture patch")
|
| 23 |
product_image = st.file_uploader("Patch of the Garment(Cut out an area from the garment)",
|
| 24 |
type=["png", "jpg", "jpeg"])
|
| 25 |
+
overlap_width = st.slider("Overlap Width", min_value=0, max_value=100, step=1, value=50)
|
| 26 |
+
what_overlap = st.selectbox(
|
| 27 |
+
'how you want to overlap?',
|
| 28 |
+
('vertical', 'horizontal'),
|
| 29 |
+
index=None,
|
| 30 |
+
placeholder="please choose an option"
|
| 31 |
+
)
|
| 32 |
if product_image:
|
| 33 |
st.image(product_image)
|
| 34 |
|
|
|
|
| 47 |
product_image_dim = product_image_n.size
|
| 48 |
x_dim = product_image_dim[0]
|
| 49 |
y_dim = product_image_dim[1]
|
| 50 |
+
if choice == "Direct Texture":
|
| 51 |
+
create_image_tile(product_image, x_dim, y_dim)
|
| 52 |
+
elif choice == "Feathered Texture":
|
| 53 |
+
create_image_with_feather_tile(product_image, x_dim, y_dim, overlap_width)
|
| 54 |
+
elif choice == "Direction Print":
|
| 55 |
+
control_texture(product_image, what_overlap, overlap_width, x_dim/2, y_dim/2)
|
| 56 |
overlay = create_layover(generated_image, 'tiled_image.png', opacity)
|
| 57 |
create_image_cutout('lay_over_image.png', gen_image_mask)
|
| 58 |
paste_image(generated_image, 'cut_out_image.png', gen_image_mask)
|