| | import gradio as gr |
| | from fastai.vision.all import * |
| | import pathlib |
| |
|
| | |
| |
|
| | plt = platform.system() |
| | if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath |
| |
|
| | learn = load_learner('YomeRecognition.pkl') |
| |
|
| | labels = learn.dls.vocab |
| |
|
| | def predict(img): |
| | img = PILImage.create(img) |
| | pred,pred_idx,probs = learn.predict(img) |
| | return {labels[i]: float(probs[i]) for i in range(len(labels))} |
| |
|
| | gr.Interface( |
| | fn=predict, |
| | inputs =gr.Image(), |
| | outputs=gr.Label(num_top_classes=5), |
| | title="๐ Sugar ๐ถ Yome ๐ฆฎ Yang Chenchen ๐ Recognition ๐", |
| | description="Classifier trainded on images of Yang Chenchen Yome, Wang Xinyao, and others. ", |
| | examples=['jpg/a.jpg', 'jpg/b.jpg', 'jpg/c.jpg', 'jpg/1.jpg', 'jpg/2.jpg', 'jpg/4.jpg', 'jpg/5.JPG', 'jpg/6.JPG', 'jpg/9.JPG'], |
| | ).launch() |
| | |
| | |
| |
|
| | |
| | |
| |
|
| | |
| | |
| | |
| | |