File size: 422 Bytes
eb6e27c
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr

def classify_image(image):
    outputs = model(image)
    return outputs  # return ถึงจะแสดงใน UI ของ Gradio

gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs="text").launch()

preds = model(image)  # สมมติเป็น logits
pred_label = organ_labels[preds.argmax()]  # แปลงเป็นชื่ออวัยวะ
return pred_label