Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,19 +30,19 @@
|
|
30 |
# #demo.launch(inline=False)
|
31 |
|
32 |
from fastai.vision.all import *
|
|
|
33 |
def input_img(img):
|
34 |
race,_,probs = learn.predict(PILImage.create('img'))
|
35 |
#race,_,probs = learn.predict(PILImage.create(img))
|
36 |
#processed_output=(f"This is a: {race}./nProbability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
|
37 |
processed_output=(f"This is a: {race}./nProbability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
|
38 |
return processed_output
|
39 |
-
learn.export('model.pkl')
|
40 |
|
41 |
im=PILImage.create(img)
|
42 |
im=PILImage.create('img')
|
43 |
im.thumbnail((192,192))
|
44 |
|
45 |
-
|
46 |
|
47 |
learn.predict(im)
|
48 |
|
|
|
30 |
# #demo.launch(inline=False)
|
31 |
|
32 |
from fastai.vision.all import *
|
33 |
+
learn=load_learner('model.pkl')
|
34 |
def input_img(img):
|
35 |
race,_,probs = learn.predict(PILImage.create('img'))
|
36 |
#race,_,probs = learn.predict(PILImage.create(img))
|
37 |
#processed_output=(f"This is a: {race}./nProbability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
|
38 |
processed_output=(f"This is a: {race}./nProbability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
|
39 |
return processed_output
|
|
|
40 |
|
41 |
im=PILImage.create(img)
|
42 |
im=PILImage.create('img')
|
43 |
im.thumbnail((192,192))
|
44 |
|
45 |
+
|
46 |
|
47 |
learn.predict(im)
|
48 |
|