Update app.py
Browse files
app.py
CHANGED
@@ -2,17 +2,7 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
import tensorflow as tf
|
4 |
import PIL
|
5 |
-
import os
|
6 |
|
7 |
-
'''
|
8 |
-
def sepia(input_img):
|
9 |
-
sepia_filter = np.array([[.393, .769, .189],
|
10 |
-
[.349, .686, .168],
|
11 |
-
[.272, .534, .131]])
|
12 |
-
sepia_img = input_img.dot(sepia_filter.T)
|
13 |
-
sepia_img /= sepia_img.max()
|
14 |
-
return sepia_img
|
15 |
-
'''
|
16 |
|
17 |
def normalize_img(img):
|
18 |
img = tf.cast(img, dtype=tf.float32)
|
@@ -29,15 +19,6 @@ def predict_and_save(img, generator_model):
|
|
29 |
def run(image_path):
|
30 |
model = tf.keras.models.load_model('pretrained')
|
31 |
print("Model loaded")
|
32 |
-
'''
|
33 |
-
img = tf.keras.preprocessing.image.load_img(
|
34 |
-
image_path, target_size=(256, 256)
|
35 |
-
)
|
36 |
-
|
37 |
-
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
38 |
-
img_array = tf.expand_dims(img_array, 0)
|
39 |
-
'''
|
40 |
-
#predict_and_save(img_array, model)
|
41 |
img_array = tf.expand_dims(image_path, 0)
|
42 |
im = predict_and_save(img_array, model)
|
43 |
print("Prediction Done")
|
|
|
2 |
import numpy as np
|
3 |
import tensorflow as tf
|
4 |
import PIL
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def normalize_img(img):
|
8 |
img = tf.cast(img, dtype=tf.float32)
|
|
|
19 |
def run(image_path):
|
20 |
model = tf.keras.models.load_model('pretrained')
|
21 |
print("Model loaded")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
img_array = tf.expand_dims(image_path, 0)
|
23 |
im = predict_and_save(img_array, model)
|
24 |
print("Prediction Done")
|