|
import gradio |
|
from fastai.vision.all import * |
|
|
|
|
|
def gradioeet(name): |
|
return "Hello " + name + "!!" |
|
|
|
|
|
def is_cat(x): return x[0].isupper() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
learn = load_learner("model_last2.pkl") |
|
|
|
categories = {"No_Cat", "Cat"} |
|
|
|
|
|
def classify_image(img): |
|
pred, idx, probs = learn.predict(img) |
|
return dict(zip(categories, map(float, probs))) |
|
|
|
|
|
image = gradio.Image(height=192, width=192) |
|
label = gradio.Label() |
|
examples = ["[email protected]", "[email protected]", "[email protected]", |
|
"[email protected]"] |
|
intf = gradio.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) |
|
intf.launch(inline=False) |
|
|
|
|
|
|
|
|