Update app.py
Browse files
app.py
CHANGED
@@ -19,24 +19,17 @@ from cv2 import *
|
|
19 |
# from PIL import Image, ImageOps
|
20 |
#import requests
|
21 |
#import tarfile
|
22 |
-
|
23 |
-
url = "https://storage.googleapis.com/tfhub-modules/google/magenta/arbitrary-image-stylization-v1-256/2.tar.gz"
|
24 |
-
response = requests.get(url,stream=True)
|
25 |
-
path_input="./"
|
26 |
-
urllib.request.urlretrieve(url, filename=path_input)
|
27 |
-
file = tarfile.open(fileobj=response.raw, mode="r|gz")
|
28 |
-
file.extractall(path="./nst_model")
|
29 |
-
'''
|
30 |
MODEL_PATH='Nst_model'
|
31 |
|
32 |
# Disable scientific notation for clarity
|
33 |
np.set_printoptions(suppress=True)
|
34 |
|
35 |
# Load model from TF-Hub
|
36 |
-
model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
37 |
|
38 |
# Load the model
|
39 |
-
|
40 |
|
41 |
def tensor_to_image(tensor):
|
42 |
tensor = tensor*255
|
|
|
19 |
# from PIL import Image, ImageOps
|
20 |
#import requests
|
21 |
#import tarfile
|
22 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
MODEL_PATH='Nst_model'
|
24 |
|
25 |
# Disable scientific notation for clarity
|
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
|