Instructions to use Canstralian/CyberAttackDetection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Canstralian/CyberAttackDetection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Canstralian/CyberAttackDetection")# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("Canstralian/CyberAttackDetection", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Create utils.py
Browse files
utils.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from prompts import PROMPTS
|
| 3 |
+
|
| 4 |
+
def get_prompt(vulnerability_type):
|
| 5 |
+
"""
|
| 6 |
+
Fetch the prompt for a specific vulnerability type.
|
| 7 |
+
"""
|
| 8 |
+
return PROMPTS.get(vulnerability_type, "No prompt available for this type.")
|
| 9 |
+
|
| 10 |
+
def save_results(output, file_name="results.json"):
|
| 11 |
+
"""
|
| 12 |
+
Save the results to a JSON file.
|
| 13 |
+
"""
|
| 14 |
+
with open(file_name, "w") as file:
|
| 15 |
+
json.dump(output, file, indent=4)
|
| 16 |
+
print(f"Results saved to {file_name}")
|