Downloads · 30 days
7
2% of all-time downloads
Abuzaid01/Ai_Human_text_detect
Ai_Human_text_detect is a text classification model from Abuzaid01. Use it when you need a label for a piece of text. It is set up for transformers.
This repository contains a RoBERTa-based model trained to distinguish between AI-generated and human-written text. The model can help identify content created by large language models like ChatGPT, Claude, and other A…
Downloads · 30 days
7
2% of all-time downloads
All-time downloads
312
Public
Parameters
125M
499 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors499 MB · 99%
From the Hugging Face model README
This repository contains a RoBERTa-based model trained to distinguish between AI-generated and human-written text. The model can help identify content created by large language models like ChatGPT, Claude, and other AI text generators.
Architecture: RoBERTa-base fine-tuned for binary classification Task: Detecting whether text is written by a human (0) or generated by AI (1) Training Data: The model was trained on a balanced dataset of human-written and AI-generated texts Input: Text with maximum length of 256 tokens Output: Binary classification with probability score
The model may not perform as well on:
Made with ❤️ by Abuzaid
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Abuzaid01/Ai_Human_text_detect"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare text for classification
text = "Your text to classify goes here."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512, padding=True)
# Run inference
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
# Get the predicted class and probabilities
probabilities = torch.nn.functional.softmax(logits, dim=1)
predicted_class_idx = torch.argmax(probabilities, dim=1).item()
confidence = probabilities[0][predicted_class_idx].item()
# Map class index to label
labels = ["Human-written", "AI-generated"]
predicted_label = labels[predicted_class_idx]
print(f"Prediction: {predicted_label}")
print(f"Confidence: {confidence:.4f}")