File size: 555 Bytes
aeb618e
 
 
e205ba6
aeb618e
e205ba6
aeb618e
 
 
 
 
 
10cfe7d
aeb618e
10cfe7d
aeb618e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from transformers import pipeline

drainage_token = os.environ.get("drainage_token")

pipeline = pipeline(task="image-classification", model="zijia88/autotrain-drainage-56552131498", use_auth_token=drainage_token)
def predict(image):
    predictions = pipeline(image)
    return {p["label"]: p["score"] for p in predictions}

gr.Interface(
    predict,
    inputs=gr.inputs.Image(label="上传管道内窥检测图片", type="filepath"),
    outputs=gr.outputs.Label(num_top_classes=5),
    title="内窥检测隐患识别",
).launch()