DavidD003 commited on
Commit
1cc47bb
·
1 Parent(s): c0994d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  from fastai.vision.all import *
3
- from PIL import Image
4
  #
5
  #learn = load_learner('export.pkl')
6
  #learn = torch.load('digit_classifier.pth')
@@ -51,7 +51,7 @@ def reduce_image_count(image):
51
 
52
  def predict(img):
53
  #First take input and reduce it to 8x8 px as the dataset was
54
- pil_image = Image.open(img) #get image
55
  gray_img = pil_image.convert('L')#grayscale
56
  pic = np.array(gray_img) #convert to array
57
  inp_img=reduce_image_count(pic)#Reduce image to required input size
 
1
  import gradio as gr
2
  from fastai.vision.all import *
3
+ from PIL import Image as pilIm
4
  #
5
  #learn = load_learner('export.pkl')
6
  #learn = torch.load('digit_classifier.pth')
 
51
 
52
  def predict(img):
53
  #First take input and reduce it to 8x8 px as the dataset was
54
+ pil_image = pilIm.open(img) #get image
55
  gray_img = pil_image.convert('L')#grayscale
56
  pic = np.array(gray_img) #convert to array
57
  inp_img=reduce_image_count(pic)#Reduce image to required input size