yupikopi commited on
Commit
318c3ac
Β·
1 Parent(s): 39496ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -5
app.py CHANGED
@@ -9,14 +9,30 @@ def psnr(y_true, y_pred):
9
  from keras.models import load_model
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)
19
  #prediction=model.predict(img_4d)[0]
20
 
21
 
22
- gr.Interface(inputs=image, outputs=decoded_imgs,interpretation='default').launch(debug='True')
 
9
  from keras.models import load_model
10
  model = load_model("./MyNet.h5", custom_objects={'psnr': psnr, 'val_psnr': psnr})
11
 
12
+ # ラップする閒数
13
+ def sepia(input_img):
14
+ sepia_img = np.asarray(sepia_img)
15
+ #image = image.astype('float32')
16
+ sepia_img = sepia_img / 255.0
17
+ sepia_img = model.predict(sepia_img)
18
+ return sepia_img
19
+
20
+ # シンプルγͺUIγ‚’δ½œζˆ
21
+ demo = gr.Interface(
22
+ fn=sepia,
23
+ inputs=gr.Image(shape=(256, 256)),
24
+ outputs="image"
25
+ )
26
+
27
+
28
+ #image = gr.inputs.Image(shape=(256,256))
29
+ #image = np.asarray(image)
30
  #image = image.astype('float32')
31
+ #image = image / 255.0
32
+ #decoded_imgs = model.predict(image)
33
 
34
  #decoded_imgs.reshape(256,256,3)
35
  #prediction=model.predict(img_4d)[0]
36
 
37
 
38
+ #gr.Interface(inputs=image, outputs=decoded_imgs,interpretation='default').launch(debug='True')