ganesh1410 commited on
Commit
ba0661b
·
1 Parent(s): cadf3a7

fix: windows runtime issue

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,5 +1,10 @@
1
  import gradio as gr
2
  from fastai.vision.all import *
 
 
 
 
 
3
 
4
  # Label function
5
  def is_cat(x:string): return x[0].isupper()
@@ -33,7 +38,6 @@ if __name__ == '__main__':
33
  def predict(image):
34
  img = PILImage.create(image)
35
  pred,pred_idx,probs = model.predict(img)
36
- # print('tt',pred,pred_idx,probs)
37
  return f"Probability it's a cat: {probs[1].item():.6f}"
38
 
39
  demo = gr.Interface(fn=model.predict, inputs="image", outputs='text')
 
1
  import gradio as gr
2
  from fastai.vision.all import *
3
+ import pathlib
4
+
5
+ # Fix for windows path run time issue
6
+ temp = pathlib.PosixPath
7
+ pathlib.PosixPath = pathlib.WindowsPath
8
 
9
  # Label function
10
  def is_cat(x:string): return x[0].isupper()
 
38
  def predict(image):
39
  img = PILImage.create(image)
40
  pred,pred_idx,probs = model.predict(img)
 
41
  return f"Probability it's a cat: {probs[1].item():.6f}"
42
 
43
  demo = gr.Interface(fn=model.predict, inputs="image", outputs='text')