zijia88's picture
Update app.py
e205ba6
raw
history blame
555 Bytes
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()