Spaces:
Build error
Build error
simayhosmeyve
commited on
Commit
•
94efff0
1
Parent(s):
ef30b3b
Update app.py
Browse files
app.py
CHANGED
@@ -447,18 +447,21 @@ pre_trained = tf.keras.models.load_model("gradio_pix2pix.h5")
|
|
447 |
#plt.imsave(name,pre)
|
448 |
#cv2.imshow(pre)
|
449 |
|
450 |
-
def result(Input):
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
|
|
|
|
|
|
462 |
|
463 |
#lst = cv2.imread('/content/drive/MyDrive/ColabNotebooks/enhance/low-sat.jpg')
|
464 |
#r = result(lst)
|
|
|
447 |
#plt.imsave(name,pre)
|
448 |
#cv2.imshow(pre)
|
449 |
|
450 |
+
def result(Input,Choice):
|
451 |
+
if Choice=="Coloring":
|
452 |
+
size0 = Input.shape[0]
|
453 |
+
size1 = Input.shape[1]
|
454 |
+
Input = cv2.resize(Input, (256,256), interpolation = cv2.INTER_AREA)
|
455 |
+
Input = cv2.cvtColor(Input , cv2.COLOR_BGR2GRAY)
|
456 |
+
Input = np.array(Input).reshape(1,256,256,1)
|
457 |
+
prediction = pre_trained(Input,training=True)
|
458 |
+
Input = prediction[0]
|
459 |
+
Input = (Input+1)*127.5
|
460 |
+
Input = np.uint8(Input)
|
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')
|
467 |
#r = result(lst)
|