yaya36095 commited on
Commit
a5b71d8
·
verified ·
1 Parent(s): dd5cb06

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -9
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("yaya36095/ai-image-detector")
25
- model = ViTForImageClassification.from_pretrained("yaya36095/ai-image-detector")
26
 
27
  def detect_image(image_path):
28
  # فتح وتجهيز الصورة
@@ -57,12 +56,22 @@ def detect_image(image_path):
57
  ]
58
  }
59
 
60
- # مثال للاستخدام
61
- # result = detect_image("path/to/image.jpg")
62
- # print(f"النتيجة: {result['prediction']}")
63
- # print(f"درجة الثقة: {result['confidence']}")
64
- # print("التفاصيل:", *result['detailed_scores'], sep="\n- ")
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