hankchin commited on
Commit
2af727d
·
verified ·
1 Parent(s): cffd9a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -1,14 +1,14 @@
1
- from fastapi import FastAPI
2
- from transformers import pipeline
3
-
4
- app = FastAPI()
5
- classifier = pipeline("text-classification")
6
-
7
- @app.get("/")
8
- def root():
9
- return {"status": "HF+FZ alive"}
10
-
11
- @app.get("/classify")
12
- def classify(text: str):
13
- result = classifier(text)
14
- return {"label": result[0]['label'], "score": result[0]['score']}
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+ app = FastAPI()
5
+ classifier = pipeline("text-classification")
6
+
7
+ @app.get("/")
8
+ def root():
9
+ return {"status": "ready"}
10
+
11
+ @app.get("/classify")
12
+ def classify(text: str):
13
+ result = classifier(text)
14
+ return {"label": result[0]["label"], "score": result[0]["score"]}