File size: 1,359 Bytes
47fccb3
7f700d7
47fccb3
 
 
 
8f0ddf2
47fccb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
import gradio as gr
from PIL import Image
import keras
from huggingface_hub import from_pretrained_keras

model = from_pretrained_keras("keras-io/lowlight-enhance-mirnet", compile=False)

def infer(original_image):
    image = keras.utils.img_to_array(original_image)
    image = image.astype("float32") / 255.0
    image = np.expand_dims(image, axis=0)
    output = model.predict(image)
    output_image = output[0] * 255.0
    output_image = output_image.clip(0, 255)
    output_image = output_image.reshape(
        (np.shape(output_image)[0], np.shape(output_image)[1], 3)
    )
    output_image = np.uint32(output_image)
    return output_image
examples=['1o.png','2o.png','3o.png']
iface = gr.Interface(
    fn=infer,
    title="Low Light Image Enhancement",
    description = "Keras Implementation of MIRNet model for lighting up a dark image πŸŒ†πŸŽ†",
    inputs=[gr.inputs.Image(label="image", type="pil")],
    outputs="image",
    examples=examples,
    cache_examples=True,
    article = "Authors: <a href=\"https://github.com/Uviveknarayan\">Vivek Narayan</a>, <a href=\"https://github.com/chiranjan-7\">Chiranjan</a>,<a href=\"https://github.com/GangaSrujan\">Srujan</a>,<a href=\"https://github.com/RohanPawar3399\">Rohan Pawar</a>,<a href=\"https://github.com/pavankarthik77\">Pavan Karthik</a>").launch(enable_queue=True)