Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#interface.close()
|
2 |
+
|
3 |
+
def car4_classifier(img):
|
4 |
+
img=np.expand_dims(img, 0)
|
5 |
+
img = preprocess_input(img)
|
6 |
+
predictionsA3 = model.predict(img)
|
7 |
+
pred=int(list(np.argmax(predictionsA3, axis=1))[0])
|
8 |
+
if pred==0:
|
9 |
+
car="GTR"
|
10 |
+
elif pred==1:
|
11 |
+
car="Porsche"
|
12 |
+
elif pred==2:
|
13 |
+
car="LEXUS"
|
14 |
+
else :
|
15 |
+
car="Lamborghini"
|
16 |
+
return car
|
17 |
+
|
18 |
+
label=gr.outputs.Label(num_top_classes=1)
|
19 |
+
|
20 |
+
interface=gr.Interface(fn=car4_classifier, inputs="image", outputs=label, live=False, title="TOSHISTATS-supercar-classifier (GTR,Porsche,Lexus,Lamborghini)")
|
21 |
+
|
22 |
+
interface.launch(share=True, debug=True)
|