Spaces:
Running
Running
File size: 578 Bytes
21dc881 3a3df03 21dc881 3a3df03 21dc881 7040d1c 2101025 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from fastapi import FastAPI
from classifier.Albert_latest import get_model
app = FastAPI()
model = get_model()
@app.post("/predict")
async def predict(issue: str):
labels = ["No", "Yes"]
predictions,label = model.predict(issue)
print(f"Predictions: {predictions}")
id = predictions
print(f"Predictions: {predictions}")
return {
"priority 1": str(predictions[0]),
"priority 2": str(predictions[1]),
"Label":label
}
@app.get("/")
async def root():
return {"message": "Welcome to the API. Use /predict to get predictions."} |