Spaces:
Runtime error
Runtime error
File size: 668 Bytes
44a24c7 b2fa953 44a24c7 b2fa953 44a24c7 b2fa953 44a24c7 b2fa953 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
import tensorflow
from tensorflow.keras.models import load_model
model = load_model('../input/cnn-model/cnn_model.h5') # aqui carregamos o modelo que treinamos e salvamos para avaliar sua capacidade de classificação
class_names = ['benign', 'malignant', 'normal']
def predict_image(img):
img_4d = img.reshape(-1, 128, 128, 3)
img_4d = img_4d/255
prediction = model.predict(img_4d)[0]
return {class_names[i]: float(prediction[i]) for i in range(3)}
image = gr.inputs.Image(shape=(128, 128))
label = gr.outputs.Label(num_top_classes=3)
gr.Interface(fn=predict_image, inputs=image, outputs=label).launch(debug=False, share=True)
|