Commit ·
6f7f750
1
Parent(s): 2267d3a
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
import numpy as np
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import keras
|
| 5 |
-
from huggingface_hub import from_pretrained_keras
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
model = from_pretrained_keras("MeetMeAt92/Enhance_Low_Light_Image", compile=False)
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def infer(original_image):
|
| 13 |
-
image = keras.utils.img_to_array(original_image)
|
| 14 |
-
image = image.astype("float32") / 255.0
|
| 15 |
-
image = np.expand_dims(image, axis=0)
|
| 16 |
-
output = model.predict(image)
|
| 17 |
-
output_image = output[0] * 255.0
|
| 18 |
-
output_image = output_image.clip(0, 255)
|
| 19 |
-
output_image = output_image.reshape(
|
| 20 |
-
(np.shape(output_image)[0], np.shape(output_image)[1], 3)
|
| 21 |
-
)
|
| 22 |
-
output_image = np.uint32(output_image)
|
| 23 |
-
return output_image
|
| 24 |
-
|
| 25 |
-
iface = gr.Interface(
|
| 26 |
-
fn=infer,
|
| 27 |
-
title="Low Light Image Enhancement",
|
| 28 |
-
description = "Keras Implementation of MIRNet model for light up the dark image 🌆🎆",
|
| 29 |
-
inputs=[gr.inputs.Image(label="image", type="pil", shape=(960, 640))],
|
| 30 |
-
outputs="image",
|
| 31 |
-
cache_examples=True).launch(enable_queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|