ayoni02 commited on
Commit ·
44b8a2d
1
Parent(s): 2dfacc4
app
Browse files
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.widgets import *
|
| 2 |
+
from fastcore.all import *
|
| 3 |
+
from fastbook import *
|
| 4 |
+
from fastai.vision.widgets import *
|
| 5 |
+
import fastbook
|
| 6 |
import gradio as gr
|
| 7 |
+
fastbook.setup_book()
|
| 8 |
+
from fastai import *
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
learn = load_learner('car_model.pkl')
|
| 12 |
+
|
| 13 |
+
cat = ('sedan', 'suv')
|
| 14 |
+
|
| 15 |
+
def classify_image(img):
|
| 16 |
+
pred,idx,probs= learn.predict(img)
|
| 17 |
+
return dict(zip(cat, map(float, probs)))
|
| 18 |
+
|
| 19 |
+
image = gr.inputs.Image(shape=(200,200))
|
| 20 |
+
label = gr.components.Label()
|
| 21 |
+
example = ['sedan.jpg','suv.jpg']
|
| 22 |
+
|
| 23 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=example)
|
| 24 |
+
intf.launch(inline=False)
|