AmrGharieb commited on
Commit
d1a1da3
·
1 Parent(s): 3d746d3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,13 +1,11 @@
1
  import gradio as gr
 
2
  from fastcore.all import *
3
  from fastai.vision.all import *
4
- from pathlib import Path
5
 
6
- plt = platform.system()
7
- if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
8
-
9
  def classify_image(img):
10
- learn = load_learner(str(Path('./nihal_model.pkl')))
11
  pred,pred_idx,probs = learn.predict(img)
12
  #return both the prediction and the probability either nihal or not and format in perccentage
13
  return pred, "{:.0%}".format(float(probs[pred_idx])),float(probs[~pred_idx])
 
1
  import gradio as gr
2
+ from fastai.vision.widgets import *
3
  from fastcore.all import *
4
  from fastai.vision.all import *
 
5
 
6
+
7
+ learn = load_learner('nihal_model.pkl')
 
8
  def classify_image(img):
 
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])