Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,7 @@ license: mit
|
|
| 10 |
# AI Image Detector
|
| 11 |
|
| 12 |
## Model Description
|
| 13 |
-
This model is designed to detect whether an image is real or AI-generated. It uses Vision Transformer (
|
| 14 |
|
| 15 |
## Model Usage
|
| 16 |
```python
|
|
@@ -43,4 +43,41 @@ def detect_image(image_path):
|
|
| 43 |
|
| 44 |
# Example usage
|
| 45 |
# result, confidence = detect_image("path/to/image.jpg")
|
| 46 |
-
# print(f"Result: {result} (Confidence: {confidence:.2f}%)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# AI Image Detector
|
| 11 |
|
| 12 |
## Model Description
|
| 13 |
+
This model is designed to detect whether an image is real or AI-generated. It uses Vision Transformer (ViT) architecture to provide accurate classification.
|
| 14 |
|
| 15 |
## Model Usage
|
| 16 |
```python
|
|
|
|
| 43 |
|
| 44 |
# Example usage
|
| 45 |
# result, confidence = detect_image("path/to/image.jpg")
|
| 46 |
+
# print(f"Result: {result} (Confidence: {confidence:.2f}%)")
|
| 47 |
+
Classes
|
| 48 |
+
The model classifies images into two categories:
|
| 49 |
+
|
| 50 |
+
Real Image (0): The image is real and not AI-generated.
|
| 51 |
+
AI Generated (1): The image is generated by AI.
|
| 52 |
+
Technical Details
|
| 53 |
+
Model Architecture: Vision Transformer (ViT)
|
| 54 |
+
Input: Images (RGB)
|
| 55 |
+
Output: Binary classification with confidence score
|
| 56 |
+
Max Image Size: 224x224 (automatically resized)
|
| 57 |
+
Requirements
|
| 58 |
+
transformers>=4.30.0
|
| 59 |
+
torch>=2.0.0
|
| 60 |
+
Pillow>=9.0.0
|
| 61 |
+
Limitations
|
| 62 |
+
Best performance with clear, high-quality images.
|
| 63 |
+
May have reduced accuracy with heavily edited photos.
|
| 64 |
+
Designed for general image detection.
|
| 65 |
+
Web Integration Example
|
| 66 |
+
javascript
|
| 67 |
+
async function detectImage(imageFile) {
|
| 68 |
+
const formData = new FormData();
|
| 69 |
+
formData.append('image', imageFile);
|
| 70 |
+
|
| 71 |
+
const response = await fetch('YOUR_API_ENDPOINT', {
|
| 72 |
+
method: 'POST',
|
| 73 |
+
body: formData
|
| 74 |
+
});
|
| 75 |
+
|
| 76 |
+
return await response.json();
|
| 77 |
+
}
|
| 78 |
+
Developer
|
| 79 |
+
Created by: yaya36095
|
| 80 |
+
License: MIT
|
| 81 |
+
Repository: https://huggingface.co/yaya36095/ai-image-detector
|
| 82 |
+
markdown
|
| 83 |
+
|