Spaces:
Sleeping
Sleeping
Swap out for a more performant model
Browse files
app.py
CHANGED
@@ -3,12 +3,11 @@ from transformers import pipeline
|
|
3 |
import os
|
4 |
import logging
|
5 |
|
6 |
-
|
7 |
# Set Hugging Face cache directory
|
8 |
os.environ["HF_HOME"] = "/app/.cache"
|
9 |
|
10 |
app = FastAPI()
|
11 |
-
classifier = pipeline("zero-shot-classification", model="
|
12 |
|
13 |
@app.get("/")
|
14 |
async def root():
|
@@ -22,4 +21,3 @@ async def predict(data: dict):
|
|
22 |
result = classifier(text, labels)
|
23 |
logging.info(f"Prediction result: {result}")
|
24 |
return {"label": result["labels"][0]}
|
25 |
-
|
|
|
3 |
import os
|
4 |
import logging
|
5 |
|
|
|
6 |
# Set Hugging Face cache directory
|
7 |
os.environ["HF_HOME"] = "/app/.cache"
|
8 |
|
9 |
app = FastAPI()
|
10 |
+
classifier = pipeline("zero-shot-classification", model="valhalla/distilbart-mnli-12-1")
|
11 |
|
12 |
@app.get("/")
|
13 |
async def root():
|
|
|
21 |
result = classifier(text, labels)
|
22 |
logging.info(f"Prediction result: {result}")
|
23 |
return {"label": result["labels"][0]}
|
|