Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # 加载模型 | |
| classifier = pipeline("text-classification", model="suredream/ml-cicd-demo") | |
| # 定义预测函数 | |
| def predict(text): | |
| return classifier(text)[0]['label'] | |
| # 创建 Gradio 接口 | |
| gr.Interface(fn=predict, inputs="text", outputs="label").launch() | |