File size: 650 Bytes
b46a24e 3c06aa6 b46a24e aec39dd b46a24e 3c06aa6 a3e1cfd 3c06aa6 a3e1cfd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from tensorflow.keras.models import Model, load_model
import gradio as gr
from pathlib import Path
import matplotlib.pyplot as plt
current_directory_path = Path(__file__).parent.resolve()
model_path = current_directory_path / "cce_dice_loss_pretrained.h5"
label_map_object = {0: 'LARGE BOWEL', 1: 'SMALL BOWEL', 2: 'STOMACH', 3: 'BACKGROUND'}
# Load the model
model = load_model(model_path)
def segment_object(image):
plt.imshow(image)
webcam = gr.inputs.Image(shape=(800, 600), source="upload", type='file') #upload
webapp = gr.interface.Interface(fn=segment_object, inputs=webcam, outputs="plot") #, live=False
webapp.launch(debug=True) |