Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
#Windows fix | |
import pathlib | |
plt = platform.system() | |
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath | |
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath | |
learn = load_learner('SaudiLandmarkClassifier.pkl') | |
def predict(input): | |
# image = gr.Image(height=224,type="pil",image_obj=input) | |
image = PILImage.create(input).resize((224,224)) | |
results = learn.predict(image)[0] | |
return results | |
iface = gr.Interface(fn=predict, inputs="image", outputs="text", examples=['Examples/A.png', 'Examples/B.png', 'Examples/C.png']) | |
iface.launch() |