|
import pathlib |
|
temp = pathlib.PosixPath |
|
pathlib.WindowsPath = pathlib.PosixPath |
|
|
|
from fastai.vision.all import * |
|
learn_inf = load_learner('learn_fluo_id.pkl') |
|
|
|
import gradio as gr |
|
labels = ['fluorescent', 'not_fluorescent'] |
|
|
|
def predict(img): |
|
img = PILImage.create(img) |
|
pred,pred_idx,probs = learn_inf.predict(img) |
|
return {labels[i]: float(probs[i]) for i in range(len(labels))} |
|
|
|
fluo_id_web = gr.Interface(fn = "predict", |
|
inputs = "image", |
|
outputs= "label", |
|
interpretation = "default", |
|
title="Fluorescence identification").launch(share=True) |
|
|
|
|
|
fluo_id_web.launch() |