Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding: utf8
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
pipeline = pipeline(task="image-classification", model="dqnguyen/vit-base_diabetic_ulcer_image_classification")
|
6 |
+
|
7 |
+
def predict(image):
|
8 |
+
predictions = pipeline(image)
|
9 |
+
return {p["label"]: p["score"] for p in predictions}
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
predict,
|
13 |
+
inputs=gr.inputs.Image(label="Upload an image (Tải một bức ảnh vét loét tiểu đường)", type="filepath"),
|
14 |
+
outputs=gr.outputs.Label(num_top_classes=5),
|
15 |
+
title="Diabetic Ulcer Image Classification",
|
16 |
+
).launch()
|