Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,9 @@
|
|
| 1 |
'''NEURAL STYLE TRANSFER'''
|
| 2 |
|
| 3 |
-
|
| 4 |
-
"""##Importing Libraries"""
|
| 5 |
-
|
| 6 |
-
|
| 7 |
import gradio as gr
|
| 8 |
import tensorflow as tf
|
| 9 |
# import os
|
|
|
|
| 10 |
import PIL
|
| 11 |
from PIL import Image,ImageOps
|
| 12 |
import numpy as np
|
|
@@ -35,8 +32,11 @@ MODEL_PATH='Nst_model'
|
|
| 35 |
# Disable scientific notation for clarity
|
| 36 |
np.set_printoptions(suppress=True)
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
# Load the model
|
| 39 |
-
model = tf.keras.models.load_model(MODEL_PATH)
|
| 40 |
|
| 41 |
def tensor_to_image(tensor):
|
| 42 |
tensor = tensor*255
|
|
|
|
| 1 |
'''NEURAL STYLE TRANSFER'''
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import tensorflow as tf
|
| 5 |
# import os
|
| 6 |
+
import tensorflow_hub as hub
|
| 7 |
import PIL
|
| 8 |
from PIL import Image,ImageOps
|
| 9 |
import numpy as np
|
|
|
|
| 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 |
+
#model = tf.keras.models.load_model(MODEL_PATH)
|
| 40 |
|
| 41 |
def tensor_to_image(tensor):
|
| 42 |
tensor = tensor*255
|