simayhosmeyve commited on
Commit
3e30039
1 Parent(s): 94efff0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -429,7 +429,7 @@ plt.xlabel('Epochs')
429
  plt.show()
430
 
431
  pre_trained = tf.keras.models.load_model("gradio_pix2pix.h5")
432
-
433
  #pre_trained.summary()
434
 
435
  #pre_trained.optimizer
@@ -461,6 +461,16 @@ def result(Input,Choice):
461
  Input = cv2.resize(Input, (size1,size0), interpolation = cv2.INTER_AREA)
462
  return Input
463
  if Choice=="Enhancement":
 
 
 
 
 
 
 
 
 
 
464
  return Input
465
 
466
  #lst = cv2.imread('/content/drive/MyDrive/ColabNotebooks/enhance/low-sat.jpg')
 
429
  plt.show()
430
 
431
  pre_trained = tf.keras.models.load_model("gradio_pix2pix.h5")
432
+ pre_trained_2 = tf.keras.models.load_model("generatorLR-HR_300.h5")
433
  #pre_trained.summary()
434
 
435
  #pre_trained.optimizer
 
461
  Input = cv2.resize(Input, (size1,size0), interpolation = cv2.INTER_AREA)
462
  return Input
463
  if Choice=="Enhancement":
464
+ size0 = Input.shape[0]
465
+ size1 = Input.shape[1]
466
+ Input = cv2.resize(Input, (256,256), interpolation = cv2.INTER_AREA)
467
+ Input = cv2.cvtColor(Input , cv2.COLOR_BGR2GRAY)
468
+ Input = np.array(Input).reshape(1,256,256,1)
469
+ prediction = pre_trained_2(Input,training=True)
470
+ Input = prediction[0]
471
+ Input = (Input+1)*127.5
472
+ Input = np.uint8(Input)
473
+ Input = cv2.resize(Input, (size1,size0), interpolation = cv2.INTER_AREA)
474
  return Input
475
 
476
  #lst = cv2.imread('/content/drive/MyDrive/ColabNotebooks/enhance/low-sat.jpg')