Nurbek-web
commited on
Commit
•
46352e6
1
Parent(s):
16357db
added model, created py script
Browse files- .gitignore +1 -0
- app.py +15 -4
- export.pkl +3 -0
- kairat.jpeg +0 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
env
|
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
from fastbook import *
|
4 |
+
from fastai.vision.widgets import *
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
|
8 |
+
learn_inf = load_learner('export.pkl')
|
9 |
+
|
10 |
+
categories = ("maxi", "kairat")
|
11 |
|
12 |
+
def classify_image(img):
|
13 |
+
pred,idx,probs = learn_inf.predict(img)
|
14 |
+
return dict(zip(categories, map(float, probs)))
|
15 |
|
16 |
+
examples = ["maxi.jpg", "kairat.jpeg"]
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(192, 192)), outputs=gr.outputs.Label(), examples=examples)
|
18 |
+
intf.launch(inline=False,share=True)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0800f67ccc5fa6c764d436d8966d7543fa28d9c2f429e7d9294f4c5b7a50e1ae
|
3 |
+
size 46964670
|
kairat.jpeg
ADDED