Update README.md
Browse files
README.md
CHANGED
@@ -15,14 +15,13 @@ This model is designed to detect whether an image is real or AI-generated. It us
|
|
15 |
|
16 |
## Model Usage
|
17 |
```python
|
18 |
-
```python
|
19 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
20 |
from PIL import Image
|
21 |
import torch
|
22 |
|
23 |
# تحميل النموذج والمعالج
|
24 |
-
processor = ViTImageProcessor.from_pretrained("
|
25 |
-
model = ViTForImageClassification.from_pretrained("
|
26 |
|
27 |
def detect_image(image_path):
|
28 |
# فتح وتجهيز الصورة
|
@@ -57,12 +56,22 @@ def detect_image(image_path):
|
|
57 |
]
|
58 |
}
|
59 |
|
60 |
-
#
|
61 |
-
|
62 |
-
#
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
```
|
67 |
|
68 |
## Classes
|
|
|
15 |
|
16 |
## Model Usage
|
17 |
```python
|
|
|
18 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
19 |
from PIL import Image
|
20 |
import torch
|
21 |
|
22 |
# تحميل النموذج والمعالج
|
23 |
+
processor = ViTImageProcessor.from_pretrained("C:/Users/SUPREME TECH/Desktop/SAM3/ai-image-detector")
|
24 |
+
model = ViTForImageClassification.from_pretrained("C:/Users/SUPREME TECH/Desktop/SAM3/ai-image-detector")
|
25 |
|
26 |
def detect_image(image_path):
|
27 |
# فتح وتجهيز الصورة
|
|
|
56 |
]
|
57 |
}
|
58 |
|
59 |
+
# كود للاختبار
|
60 |
+
if __name__ == "__main__":
|
61 |
+
# يمكنك تغيير مسار الصورة هنا
|
62 |
+
image_path = "path/to/your/image.jpg"
|
63 |
+
|
64 |
+
try:
|
65 |
+
result = detect_image(image_path)
|
66 |
+
print("\nنتائج تحليل الصورة:")
|
67 |
+
print(f"التصنيف: {result['prediction']}")
|
68 |
+
print(f"درجة الثقة: {result['confidence']}")
|
69 |
+
print("\nالتفاصيل:")
|
70 |
+
for score in result['detailed_scores']:
|
71 |
+
print(f"- {score}")
|
72 |
+
|
73 |
+
except Exception as e:
|
74 |
+
print(f"حدث خطأ: {str(e)}")
|
75 |
```
|
76 |
|
77 |
## Classes
|