prithivMLmods commited on
Commit
c706302
·
verified ·
1 Parent(s): aae3ef5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -0
README.md CHANGED
@@ -1,6 +1,26 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
4
  ```py
5
  Classification Report:
6
  precision recall f1-score support
@@ -15,3 +35,73 @@ weighted avg 0.9989 0.9989 0.9989 9999
15
  ```
16
 
17
  ![sdsxzdcvxzdcv.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/uZE8mfoCjc_hbCJg17xy1.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - prithivMLmods/AI-vs-Deepfake-vs-Real
5
+ language:
6
+ - en
7
+ base_model:
8
+ - google/siglip2-base-patch16-224
9
+ pipeline_tag: image-classification
10
+ library_name: transformers
11
+ tags:
12
+ - AI-vs-Deepfake-vs-Real
13
+ - '9999'
14
+ - Deepfake
15
  ---
16
+
17
+ ![7.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/nIqLiFYrhj1XEF9xeDPI4.png)
18
+
19
+
20
+ # **AI-vs-Deepfake-vs-Real-9999**
21
+
22
+ > **AI-vs-Deepfake-vs-Real-9999** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to detect whether an image is AI-generated, a deepfake, or a real one using the **SiglipForImageClassification** architecture.
23
+
24
  ```py
25
  Classification Report:
26
  precision recall f1-score support
 
35
  ```
36
 
37
  ![sdsxzdcvxzdcv.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/uZE8mfoCjc_hbCJg17xy1.png)
38
+
39
+
40
+ The model categorizes images into three classes:
41
+ - **Class 0:** "Artificial"
42
+ - **Class 1:** "Deepfake"
43
+ - **Class 2:** "Real one"
44
+
45
+ ---
46
+
47
+ # **Run with Transformers🤗**
48
+
49
+ ```python
50
+ !pip install -q transformers torch pillow gradio
51
+ ```
52
+
53
+ ```python
54
+ import gradio as gr
55
+ from transformers import AutoImageProcessor
56
+ from transformers import SiglipForImageClassification
57
+ from transformers.image_utils import load_image
58
+ from PIL import Image
59
+ import torch
60
+
61
+ # Load model and processor
62
+ model_name = "prithivMLmods/AI-vs-Deepfake-vs-Real-9999"
63
+ model = SiglipForImageClassification.from_pretrained(model_name)
64
+ processor = AutoImageProcessor.from_pretrained(model_name)
65
+
66
+ def classify_image(image):
67
+ """Predicts whether an image is Artificial, Deepfake, or Real."""
68
+ image = Image.fromarray(image).convert("RGB")
69
+ inputs = processor(images=image, return_tensors="pt")
70
+
71
+ with torch.no_grad():
72
+ outputs = model(**inputs)
73
+ logits = outputs.logits
74
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
75
+
76
+ labels = {
77
+ "0": "Artificial", "1": "Deepfake", "2": "Real one"
78
+ }
79
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
80
+
81
+ return predictions
82
+
83
+ # Create Gradio interface
84
+ iface = gr.Interface(
85
+ fn=classify_image,
86
+ inputs=gr.Image(type="numpy"),
87
+ outputs=gr.Label(label="Prediction Scores"),
88
+ title="AI vs. Deepfake vs. Real Image Classification",
89
+ description="Upload an image to determine if it's AI-generated, a Deepfake, or a Real one."
90
+ )
91
+
92
+ # Launch the app
93
+ if __name__ == "__main__":
94
+ iface.launch()
95
+ ```
96
+
97
+ ---
98
+
99
+ # **Intended Use:**
100
+
101
+ The **AI-vs-Deepfake-vs-Real-9999** model is designed to classify images into three categories: AI-generated, deepfake, or real. Potential use cases include:
102
+
103
+ - **AI Content Detection:** Identifying AI-generated images from real ones.
104
+ - **Deepfake Detection:** Assisting cybersecurity experts and forensic teams in detecting synthetic media.
105
+ - **Media Verification:** Helping journalists and fact-checkers verify the authenticity of images.
106
+ - **AI Ethics & Research:** Contributing to studies on AI-generated content detection.
107
+ - **Social Media Moderation:** Enhancing tools to prevent misinformation and digital deception.