Spaces:
Sleeping
Sleeping
File size: 481 Bytes
ceb1df4 4b33459 ceb1df4 81080d8 29718f4 11f91c9 ceb1df4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from transformers import pipeline
from fastapi import FastAPI
app = FastAPI()
classifier = pipeline("zero-shot-classification", model='facebook/bart-large-mnli')
@app.get("/")
async def root():
return {"Hell": "Yeah!"}
@app.get("/predict")
async def root(title):
categories = ["technology", "sports", "politics", "weather", "business", "entertainment"]
response = classifier(title, categories)
response["category"] = response["labels"][0]
return response
|