Create Python
Browse files
Python
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def classify_image(image):
|
| 4 |
+
outputs = model(image)
|
| 5 |
+
return outputs # return ถึงจะแสดงใน UI ของ Gradio
|
| 6 |
+
|
| 7 |
+
gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs="text").launch()
|
| 8 |
+
|
| 9 |
+
preds = model(image) # สมมติเป็น logits
|
| 10 |
+
pred_label = organ_labels[preds.argmax()] # แปลงเป็นชื่ออวัยวะ
|
| 11 |
+
return pred_label
|