Spaces:
Runtime error
Runtime error
NoName
commited on
Commit
·
1950f82
1
Parent(s):
0101d40
Add application file
Browse files- app.py +19 -3
- export_resnet18_e12_3.pkl +3 -0
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
import pathlib
|
5 |
+
temp = pathlib.PosixPath
|
6 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
7 |
|
8 |
+
catergories = ('bunny girl', 'cat neko girl', 'fox kitsune girl', 'wolfgirl')
|
9 |
+
|
10 |
+
def load_model_and_predict(img):
|
11 |
+
#img = PILImage.create(image_path)
|
12 |
+
pred, idx, probs = learn.predict(img)
|
13 |
+
#return pred, probs
|
14 |
+
return dict(zip(catergories, map(float,probs)))
|
15 |
+
|
16 |
+
model_path = "export_resnet101_e7_2.pkl"
|
17 |
+
learn = load_learner(model_path)
|
18 |
+
|
19 |
+
image = gr.inputs.Image(shape=(224, 224))
|
20 |
+
label = gr.outputs.Label()
|
21 |
+
|
22 |
+
iface = gr.Interface(fn=load_model_and_predict, inputs=image, outputs=label)
|
23 |
iface.launch()
|
export_resnet18_e12_3.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:98e3e35c97028932aa02dc312a1505b64dcd7b7ccda8bd7917c467e25a4aa485
|
3 |
+
size 46981469
|