hypn05 commited on
Commit
563fae7
·
verified ·
1 Parent(s): dbe37a0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -10
README.md CHANGED
@@ -61,21 +61,27 @@ A **fast, accurate Small Language Model (SLM)** that detects secrets in code bef
61
  ```python
62
  from transformers import pipeline
63
 
 
64
  classifier = pipeline(
65
  "text-classification",
66
  model="hypn05/secrets-sentinel"
67
  )
68
 
69
- # Examples
70
- results = classifier([
71
- "password='supersecret123'", # DETECTS SECRET
72
- "api_key = 'sk-1234567890abc'", # DETECTS SECRET
73
- "print('Hello, world!')", # Normal code
74
- "def calculate_sum(a, b):", # Normal code
75
- ])
76
-
77
- for text, result in zip(["Test1", "Test2", "Test3", "Test4"], results):
78
- print(f"{result['label']:>8} | {text}")
 
 
 
 
 
79
  ```
80
 
81
  ## Advanced Usage
 
61
  ```python
62
  from transformers import pipeline
63
 
64
+ # Load the pipeline with the secrets detection model
65
  classifier = pipeline(
66
  "text-classification",
67
  model="hypn05/secrets-sentinel"
68
  )
69
 
70
+ # Define the input examples
71
+ inputs = [
72
+ "password='supersecret123'", # Expected: Secret
73
+ "api_key = 'sk-1234567890abc'", # Expected: Secret
74
+ "print('Hello, world!')", # Expected: Safe
75
+ "def calculate_sum(a, b):", # Expected: Safe
76
+ ]
77
+
78
+ # Run the classifier on the inputs
79
+ results = classifier(inputs)
80
+
81
+ # Print the actual input string and the result ("Secret" if LABEL_1, else "Safe")
82
+ for input_text, result in zip(inputs, results):
83
+ label = "Secret" if result['label'] == "LABEL_1" else "Safe"
84
+ print(f"{label} | {input_text}")
85
  ```
86
 
87
  ## Advanced Usage