Toshifumi's picture
Update app.py
235bec6
raw
history blame
No virus
715 Bytes
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)