Spaces:
Build error
Build error
Sophie98
commited on
Commit
β’
a402a5e
1
Parent(s):
eca5c36
final fixes hopefully
Browse files- app.py +2 -2
- segmentation.py +0 -2
- styleTransfer.py +3 -0
app.py
CHANGED
@@ -115,9 +115,9 @@ demo = gr.Interface(
|
|
115 |
outputs = 'image',
|
116 |
examples= [example1, example2, example3 ,example4 ,example5],
|
117 |
title="π Style your sofa π ",
|
118 |
-
description="Customize your sofa to your
|
119 |
\nProvide a picture of your sofa and a desired pattern\
|
120 |
-
or choose one of the examples below.
|
121 |
# article="**References**\n\n"
|
122 |
# "<a href='https://www.tensorflow.org/hub/tutorials/tf2_arbitrary_image_stylization' target='_blank'>1. Tutorial to implement Fast Neural Style Transfer using the pretrained model from TensorFlow Hub</a> \n"
|
123 |
# "<a href='https://huggingface.co/spaces/luca-martial/neural-style-transfer' target='_blank'>2. The idea to build a neural style transfer application was inspired from this Hugging Face Space </a>"
|
115 |
outputs = 'image',
|
116 |
examples= [example1, example2, example3 ,example4 ,example5],
|
117 |
title="π Style your sofa π ",
|
118 |
+
description="Customize your sofa to your wildest dreams π!\
|
119 |
\nProvide a picture of your sofa and a desired pattern\
|
120 |
+
or choose one of the examples below. β¬",
|
121 |
# article="**References**\n\n"
|
122 |
# "<a href='https://www.tensorflow.org/hub/tutorials/tf2_arbitrary_image_stylization' target='_blank'>1. Tutorial to implement Fast Neural Style Transfer using the pretrained model from TensorFlow Hub</a> \n"
|
123 |
# "<a href='https://huggingface.co/spaces/luca-martial/neural-style-transfer' target='_blank'>2. The idea to build a neural style transfer application was inspired from this Hugging Face Space </a>"
|
segmentation.py
CHANGED
@@ -67,8 +67,6 @@ def replace_sofa(image:Image, mask:Image, styled_sofa:Image) -> Image:
|
|
67 |
new_image = Image containing the styled sofa
|
68 |
"""
|
69 |
image,mask,styled_sofa = np.array(image),np.array(mask),np.array(styled_sofa)
|
70 |
-
#image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
71 |
-
styled_sofa = cv2.cvtColor(styled_sofa, cv2.COLOR_BGR2RGB)
|
72 |
|
73 |
_, mask = cv2.threshold(mask, 10, 255, cv2.THRESH_BINARY)
|
74 |
mask_inv = cv2.bitwise_not(mask)
|
67 |
new_image = Image containing the styled sofa
|
68 |
"""
|
69 |
image,mask,styled_sofa = np.array(image),np.array(mask),np.array(styled_sofa)
|
|
|
|
|
70 |
|
71 |
_, mask = cv2.threshold(mask, 10, 255, cv2.THRESH_BINARY)
|
72 |
mask_inv = cv2.bitwise_not(mask)
|
styleTransfer.py
CHANGED
@@ -123,6 +123,9 @@ def perform_style_transfer(content_image, style_image):
|
|
123 |
stylized_image = output[0]
|
124 |
return Image.fromarray(np.uint8(stylized_image[0] * 255))
|
125 |
|
|
|
|
|
|
|
126 |
def create_styledSofa(sofa:Image, style:Image):
|
127 |
styled_sofa = StyleTransformer(sofa,style)
|
128 |
return styled_sofa
|
123 |
stylized_image = output[0]
|
124 |
return Image.fromarray(np.uint8(stylized_image[0] * 255))
|
125 |
|
126 |
+
################################################# MAIN ################################################
|
127 |
+
|
128 |
+
|
129 |
def create_styledSofa(sofa:Image, style:Image):
|
130 |
styled_sofa = StyleTransformer(sofa,style)
|
131 |
return styled_sofa
|