File size: 478 Bytes
10d670a
 
c90e47e
 
 
 
 
 
 
 
 
 
 
10d670a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr

#def greet(name):
#    return "Hello " + name + "!"
    
def on_click_classify(change):
    img = PILImage.create(btn_upload.data[-1])
    out_pl.clear_output()
    with out_pl: display(img.to_thumb(128,128))
    pred,pred_idx,probs = learn_inf.predict(img)
    lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'

btn_run.on_click(on_click_classify)

iface = gr.Interface(fn=greet, inputs="text", outputs="text")   
iface.launch()