yupikopi commited on
Commit
e6f39bd
Β·
1 Parent(s): ab77ffd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -9,13 +9,23 @@ from keras.models import load_model
9
  model = load_model("./MyNet.h5", custom_objects={'psnr': psnr, 'val_psnr': psnr})
10
 
11
  # ラップする閒数
12
- def sepia(input_img):
13
- sepia_img = np.asarray(input_img)
14
- sepia_img = sepia_img.astype('float32')
15
- sepia_img = sepia_img / 255.0
16
- sepia_img = model.predict(sepia_img)
 
 
 
 
 
 
 
 
17
  return sepia_img
18
 
 
 
19
  # シンプルγͺUIγ‚’δ½œζˆ
20
  demo = gr.Interface(
21
  fn=sepia,
 
9
  model = load_model("./MyNet.h5", custom_objects={'psnr': psnr, 'val_psnr': psnr})
10
 
11
  # ラップする閒数
12
+ #def sepia(input_img):
13
+ # sepia_img = np.asarray(input_img)
14
+ # sepia_img = sepia_img.astype('float32')
15
+ # sepia_img = sepia_img / 255.0
16
+ # sepia_img = model.predict(sepia_img)
17
+ # return sepia_img
18
+
19
+ def sepia(inp):
20
+ inp = inp.reshape((-1, 256, 256, 3))
21
+ inp = np.asarray(inp)
22
+ inp = inp.astype('float32')
23
+ inp = inp / 255.0
24
+ sepia_img = model.predict(inp)
25
  return sepia_img
26
 
27
+
28
+
29
  # シンプルγͺUIγ‚’δ½œζˆ
30
  demo = gr.Interface(
31
  fn=sepia,