Spaces:
Sleeping
Sleeping
Switch to smaller DistilBERT model for HF free tier compatibility
Browse files1 unmodified line2345678910111232 unmodified lines45464748495051525354555657588 unmodified lines6768697071727374 unmodified lines1481491501511521531541 unmodified linefrom transformers import pipelineimport json# Load the zero-shot classification modelprint("Loading model: facebook/bart-large-mnli...")classifier = pipeline("zero-shot-classification",model="facebook/bart-large-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"}else:output = {"text": text,"prediction": result['labels'][0],"confidence": f"{result['scores'][0]:.4f}","model": "facebook/bart-large-mnli"}return output8 unmodified lines"""# 🎯 Zero-Shot Text ClassificationClassify any text into custom categories using **DeBERTa-v3-large-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- **Task:** Zero-Shot Text Classification- **License:** MIT1 unmodified line2345678910111232 unmodified lines45464748495051525354555657588 unmodified lines6768697071727374 unmodified lines1481491501511521531541 unmodified linefrom transformers import pipelineimport json# 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="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": "typeform/distilbert-base-uncased-mnli"}else:output = {"text": text,"prediction": result['labels'][0],"confidence": f"{result['scores'][0]:.4f}","model": "typeform/distilbert-base-uncased-mnli"}return output8 unmodified lines"""# 🎯 Zero-Shot Text ClassificationClassify 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:** typeform/distilbert-base-uncased-mnli- **Task:** Zero-Shot Text Classification- **License:** MIT
app.py+7-7