Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,10 +26,10 @@ MODEL_PATH='Nst_model'
|
|
26 |
np.set_printoptions(suppress=True)
|
27 |
|
28 |
# Load model from TF-Hub
|
29 |
-
model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
30 |
|
31 |
# Load the model
|
32 |
-
|
33 |
|
34 |
def tensor_to_image(tensor):
|
35 |
tensor = tensor*255
|
@@ -68,7 +68,7 @@ def gray_scaled(inp_img):
|
|
68 |
|
69 |
def transform_mymodel(content_image,style_image):
|
70 |
# Convert to float32 numpy array, add batch dimension, and normalize to range [0, 1]
|
71 |
-
content_image=gray_scaled(content_image)
|
72 |
content_image = content_image.astype(np.float32)[np.newaxis, ...] / 255.0
|
73 |
style_image = style_image.astype(np.float32)[np.newaxis, ...] / 255.0
|
74 |
|
|
|
26 |
np.set_printoptions(suppress=True)
|
27 |
|
28 |
# Load model from TF-Hub
|
29 |
+
#model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
30 |
|
31 |
# Load the model
|
32 |
+
model = tf.keras.models.load_model(MODEL_PATH)
|
33 |
|
34 |
def tensor_to_image(tensor):
|
35 |
tensor = tensor*255
|
|
|
68 |
|
69 |
def transform_mymodel(content_image,style_image):
|
70 |
# Convert to float32 numpy array, add batch dimension, and normalize to range [0, 1]
|
71 |
+
#content_image=gray_scaled(content_image)
|
72 |
content_image = content_image.astype(np.float32)[np.newaxis, ...] / 255.0
|
73 |
style_image = style_image.astype(np.float32)[np.newaxis, ...] / 255.0
|
74 |
|