Spaces:
Runtime error
Runtime error
Download model.py from KB-Infinity-Tech/RealTimeWebSecurityAssistant: direct link, hf CLI and curl.
- Browser
- Download file 369 Bytes
-
https://huggingface.co/spaces/KB-Infinity-Tech/RealTimeWebSecurityAssistant/resolve/4183ac44563c2c81ac3a48bfba474664cd7eb26b/model.py
- Command line
-
hf download hf://spaces/KB-Infinity-Tech/RealTimeWebSecurityAssistant@4183ac44563c2c81ac3a48bfba474664cd7eb26b/model.py
-
curl -L -o model.py https://huggingface.co/spaces/KB-Infinity-Tech/RealTimeWebSecurityAssistant/resolve/4183ac44563c2c81ac3a48bfba474664cd7eb26b/model.py
369 Bytes
| from transformers import pipeline | |
| classifier = pipeline( | |
| "text-classification", | |
| model="mrm8488/bert-tiny-finetuned-sms-spam-detection" | |
| ) | |
| def predict_text(text): | |
| result = classifier(text)[0] | |
| label = result["label"] | |
| score = result["score"] | |
| return { | |
| "prediction": label, | |
| "confidence": round(score * 100, 2) | |
| } |