Spaces:
Runtime error
Runtime error
Abduhoshim
commited on
Commit
·
291d932
1
Parent(s):
59df1d0
app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
learn = load_learner('https://drive.google.com/file/d/1mYN7tOaKpv6sgPt6ekSIoceRQijVGviV/view?usp=share_link')
|
3 |
+
labels = learn.dls.vocab
|
4 |
+
def predict(img):
|
5 |
+
img = PILImage.create(img)
|
6 |
+
pred,pred_idx,probs = learn.predict(img)
|
7 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
8 |
+
|
9 |
+
title = "Damaged Car Classifier"
|
10 |
+
description = "This model can identify damaged cars"
|
11 |
+
|
12 |
+
itfr = gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,interpretation='default',enable_queue=True).launch(share=True)
|
13 |
+
itfr.launch(inline=False)
|