Spaces:
Sleeping
Sleeping
Switch to smaller DistilBERT model for HF free tier compatibility
Browse files1 unmodified line2345656789910111232 unmodified lines454647484849505152535455555657588 unmodified lines676869707071727374 unmodified lines1481491501511511521531541 unmodified linefrom transformers import pipelineimport json
# Load the zero-shot classification modelprint("Loading model: facebook/bart-large-mnli...")# Load the zero-shot classification model (smaller model for free tier)print("Loading model: typeform/distilbert-base-uncased-mnli...")classifier = pipeline( "zero-shot-classification", model="facebook/bart-large-mnli", model="typeform/distilbert-base-uncased-mnli", device=-1 # Use CPU)print("Model loaded successfully!")32 unmodified lines "prediction": result['labels'][0], "confidence": f"{result['scores'][0]:.4f}", "all_scores": scores_dict, "model": "facebook/bart-large-mnli" "model": "typeform/distilbert-base-uncased-mnli" } else: output = { "text": text, "prediction": result['labels'][0], "confidence": f"{result['scores'][0]:.4f}", "model": "facebook/bart-large-mnli" "model": "typeform/distilbert-base-uncased-mnli" }
return output8 unmodified lines """ # 🎯 Zero-Shot Text Classification
Classify any text into custom categories using **DeBERTa-v3-large-mnli** model. Classify any text into custom categories using **DistilBERT-base-uncased-mnli** model.
This model can classify text into any categories you define, without needing training data! """74 unmodified lines ---
### Model Information - **Model:** microsoft/deberta-v3-large-mnli - **Model:** typeform/distilbert-base-uncased-mnli - **Task:** Zero-Shot Text Classification - **License:** MIT
app.py+7-7