Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
app = FastAPI()
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
pipe = pipeline("text-classification", model="kmcs-casulit/hr_cate")
|
7 |
+
|
8 |
+
@app.get("/")
|
9 |
+
def greet_json():
|
10 |
+
return {"message": "Hello, World!"}
|
11 |
+
|
12 |
+
@app.get("/")
|
13 |
+
def classify(text: str):
|
14 |
+
output = pipe(text)
|
15 |
+
return {"output": output[0]['label']}
|