File size: 709 Bytes
56bc10e
 
 
 
64e11a5
a1621b8
08d4010
 
28d6366
606304d
28d6366
 
 
 
 
 
713505e
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pathlib
temp = pathlib.PosixPath
pathlib.WindowsPath = pathlib.PosixPath
  
from fastai.vision.all import *
learn_inf = load_learner('export.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()