Spaces:
Build error
Build error
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() | |