File size: 870 Bytes
7e11116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
import gradio as gr
import keras
from keras.models import load_model
from tensorflow_addons.layers import InstanceNormalization
import matplotlib.pyplot as plt
import numpy as np

model=load_model('g_model_AtoB_002160.h5')

def show_preds_image(image_path):
    image = plt.imread(image_path)
    image=np.expand_dims(image,axis=0)
    outputs = model.predict(image)
    image=np.squeeze(outputs,axis=0)
    return image
 
inputs_image = [
    gr.components.Image(type="filepath", label="Input Image"),
]
outputs_image = [
    gr.components.Image(type="numpy", label="Output Image"),
]
interface_image = gr.Interface(
    fn=show_preds_image,
    inputs=inputs_image,
    outputs=outputs_image,
    title="Pothole detector",
    examples=path,
    cache_examples=False,
)

gr.TabbedInterface(
    [interface_image],
    tab_names=['Image inference']
).queue().launch()