File size: 669 Bytes
235bec6
5936da3
f1b0482
 
 
 
 
9c73196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
09cf3aa
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
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)