Spaces:
Runtime error
Runtime error
import math | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
import tensorflow_addons as tfa | |
import matplotlib.pyplot as plt | |
from tensorflow.keras import layers | |
from tensorflow.keras.models import load_model | |
model = load_model('modelCerv.h5') | |
response = requests.get("https://github.com/abdulkader902017/CervixNet/blob/main/labels.txt") | |
labels = response.text.split("\n") | |
def classify_image(inp): | |
inp = inp.reshape((-1, 32, 32, 3)) | |
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp) | |
prediction = inception_net.predict(inp).flatten() | |
confidences = {labels[i]: float(prediction[i]) for i in range(3)} | |
return confidences | |
gr.Interface(fn=classify_image, | |
inputs=gr.Image(shape=(32, 32)), | |
outputs=gr.Label(num_top_classes=3)).launch() |