Spaces:
Sleeping
Sleeping
Jun Xiong
commited on
Commit
·
15231c2
1
Parent(s):
afde245
Deploy model to Hugging Face Space
Browse files- app.py +12 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# 加载模型
|
5 |
+
classifier = pipeline("sentiment-analysis", model="suredream/ml-cicd-demo")
|
6 |
+
|
7 |
+
# 定义预测函数
|
8 |
+
def predict(text):
|
9 |
+
return classifier(text)
|
10 |
+
|
11 |
+
# 创建 Gradio 接口
|
12 |
+
gr.Interface(fn=predict, inputs="text", outputs="label").launch()
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
datasets
|
3 |
+
wandb
|
4 |
+
gradio
|
5 |
+
pyyaml
|