Spaces:
Runtime error
Runtime error
File size: 715 Bytes
235bec6 f1b0482 9c73196 |
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 |
import tensorflow as tf
import gradio as gr
from tensorflow.keras.models import load_model
model = load_model('SD_4car_20230110_h5')
#interface.close()
def car4_classifier(img):
img=np.expand_dims(img, 0)
img = preprocess_input(img)
predictionsA3 = model.predict(img)
pred=int(list(np.argmax(predictionsA3, axis=1))[0])
if pred==0:
car="GTR"
elif pred==1:
car="Porsche"
elif pred==2:
car="LEXUS"
else :
car="Lamborghini"
return car
label=gr.outputs.Label(num_top_classes=1)
interface=gr.Interface(fn=car4_classifier, inputs="image", outputs=label, live=False, title="TOSHISTATS-supercar-classifier (GTR,Porsche,Lexus,Lamborghini)")
interface.launch(share=True, debug=True) |