yupikopi commited on
Commit
eee0150
·
1 Parent(s): ce94aa4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -1,5 +1,7 @@
1
  import keras.backend as K
2
  import gradio as gr
 
 
3
 
4
  def psnr(y_true, y_pred):
5
  return -10*K.log(K.mean(K.flatten((y_true - y_pred))**2)) / np.log(10)
@@ -8,6 +10,9 @@ from keras.models import load_model
8
  model = load_model("./MyNet.h5", custom_objects={'psnr': psnr, 'val_psnr': psnr})
9
 
10
  image = gr.inputs.Image(shape=(256,256))
 
 
 
11
  decoded_imgs = model.predict(image)
12
 
13
  #decoded_imgs.reshape(256,256,3)
 
1
  import keras.backend as K
2
  import gradio as gr
3
+ import numpy as np
4
+
5
 
6
  def psnr(y_true, y_pred):
7
  return -10*K.log(K.mean(K.flatten((y_true - y_pred))**2)) / np.log(10)
 
10
  model = load_model("./MyNet.h5", custom_objects={'psnr': psnr, 'val_psnr': psnr})
11
 
12
  image = gr.inputs.Image(shape=(256,256))
13
+ image = np.asarray(image)
14
+ image = image.astype('float32')
15
+ image = image / 255.0
16
  decoded_imgs = model.predict(image)
17
 
18
  #decoded_imgs.reshape(256,256,3)