Spaces:
Sleeping
Sleeping
Commit
·
4342e8e
1
Parent(s):
7d934c9
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from fastcore.all import *
|
3 |
from fastai.vision.all import *
|
4 |
-
|
|
|
|
|
5 |
def classify_image(img):
|
6 |
-
learn = load_learner('./nihal_model.pkl')
|
7 |
pred,pred_idx,probs = learn.predict(img)
|
8 |
#return both the prediction and the probability either nihal or not and format in perccentage
|
9 |
return pred, "{:.0%}".format(float(probs[pred_idx])),float(probs[~pred_idx])
|
|
|
1 |
import gradio as gr
|
2 |
from fastcore.all import *
|
3 |
from fastai.vision.all import *
|
4 |
+
plt = platform.system()
|
5 |
+
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
6 |
+
|
7 |
def classify_image(img):
|
8 |
+
learn = load_learner(str(Path('./nihal_model.pkl')))
|
9 |
pred,pred_idx,probs = learn.predict(img)
|
10 |
#return both the prediction and the probability either nihal or not and format in perccentage
|
11 |
return pred, "{:.0%}".format(float(probs[pred_idx])),float(probs[~pred_idx])
|