Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| # Public, stable model that works on Spaces | |
| text_model = pipeline( | |
| task="text-classification", | |
| model="distilbert-base-uncased-finetuned-sst-2-english", # sentiment model used as a placeholder for "credibility" | |
| device=-1 # CPU | |
| ) | |
| # Map a variety of possible raw labels to friendly names. | |
| # Different transformers versions may return NEGATIVE/POSITIVE or LABEL_0/LABEL_1. | |
| TEXT_FRIENDLY_MAP = { | |
| "NEGATIVE": "Fake / Not Credible", | |
| "LABEL_0": "Fake / Not Credible", | |
| "POSITIVE": "Real / Credible", | |
| "LABEL_1": "Real / Credible", | |
| } | |