File size: 622 Bytes
d075326
808bac7
48e0717
808bac7
 
dba80eb
 
9c7562d
48e0717
808bac7
 
 
 
 
 
 
 
 
d8c399e
48e0717
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()