Toshifumi's picture
Update app.py
e3b0032
raw
history blame contribute delete
No virus
669 Bytes
import tensorflow as tf
import numpy as np
import gradio as gr
from tensorflow.keras.models import load_model
model = load_model('SD_4car_20230110_h5')
def car4_classifier(img):
img=np.expand_dims(img, 0)
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(debug=True)