darwinkernelpanic commited on
Commit
f36d920
·
verified ·
1 Parent(s): 0026528

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ library_name: transformers
5
+ tags:
6
+ - ai-detection
7
+ - text-classification
8
+ - onnx
9
+ - education
10
+ ---
11
+
12
+ # AI Detector PGX
13
+
14
+ BERT-based classifier for detecting AI-generated text in student essays. Trained on PG assignments.
15
+
16
+ ## Quick Start
17
+
18
+ ### Python
19
+ ```python
20
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
21
+ import torch
22
+
23
+ model_id = "darwinkernelpanic/ai-detector-pgx"
24
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
25
+ model = AutoModelForSequenceClassification.from_pretrained(model_id)
26
+
27
+ text = "The mitochondria is the powerhouse of the cell..."
28
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
29
+
30
+ with torch.no_grad():
31
+ outputs = model(**inputs)
32
+ probs = torch.softmax(outputs.logits, dim=1)
33
+ ai_prob = probs[0][1].item()
34
+
35
+ print(f"AI Probability: {ai_prob:.2%}")
36
+ ```
37
+
38
+ ### JavaScript (ONNX)
39
+ ```javascript
40
+ import * as ort from 'onnxruntime-web';
41
+
42
+ const session = await ort.InferenceSession.create('model.onnx');
43
+ // Tokenize with @xenova/transformers, then run inference
44
+ const results = await session.run({ input_ids, attention_mask });
45
+ const logits = results.logits.data;
46
+ const aiProb = Math.exp(logits[1]) / (Math.exp(logits[0]) + Math.exp(logits[1]));
47
+ ```
48
+
49
+ ## Model Details
50
+
51
+ - **Base:** prajjwal1/bert-tiny (4.4M params)
52
+ - **Classes:** human (0), ai (1)
53
+ - **Sequence length:** 512 tokens
54
+ - **ONNX size:** 255MB
55
+
56
+ ## Limitations
57
+
58
+ Trained on academic essays — may not generalize to all text types.