Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 =
|
| 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
|