Updated Interface + New Images
Browse files- .gitattributes +1 -0
- README.md +3 -3
- app.py +24 -7
- fake_images/bird_003.jpg +3 -0
- fake_images/example_mjv5.jpg +0 -0
- fake_images/example_sdxl.jpg +0 -0
- fake_images/landscape_002.jpg +3 -0
- fake_images/landscape_004.jpg +3 -0
- fake_images/lighthouse.jpg +3 -0
- fake_images/living-room.jpg +3 -0
- fake_images/man_001.jpg +3 -0
- fake_images/simpsons_002.jpg +3 -0
- fake_images/woman_017.jpg +3 -0
- fake_images/woman_018.jpg +3 -0
- fake_images/woman_021.jpg +3 -0
- real_images/012.jpg +3 -0
- real_images/023.jpg +3 -0
- real_images/030.jpg +3 -0
- real_images/244qppeo8b881.jpg +3 -0
- real_images/26101851686_e4ba08c948_o.jpg +3 -0
- real_images/2ieabkz5smr61.jpg +3 -0
- real_images/example_authentic.jpg +0 -0
- real_images/example_dalle3.jpg +0 -0
- real_images/oe8tflh3gfx91.jpg +3 -0
- real_images/og2dixbnio5b1.jpg +3 -0
- real_images/ok2rrp8fpvw91.jpg +3 -0
- real_images/sijgfsx7po1a1.jpg +3 -0
.gitattributes
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
|
|
10 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
|
|
7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
11 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
12 |
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
13 |
*.model filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
-
title: SuSy
|
3 |
-
emoji:
|
4 |
colorFrom: gray
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
@@ -8,7 +8,7 @@ sdk_version: 4.44.1
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
-
short_description:
|
12 |
---
|
13 |
|
14 |
# SuSy - Synthetic Image Detector
|
|
|
1 |
---
|
2 |
+
title: SuSy Game
|
3 |
+
emoji: 🕵️
|
4 |
colorFrom: gray
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
+
short_description: Compete against SuSy to spot AI-Generated images!
|
12 |
---
|
13 |
|
14 |
# SuSy - Synthetic Image Detector
|
app.py
CHANGED
@@ -7,8 +7,8 @@ from skimage.feature import graycomatrix, graycoprops
|
|
7 |
from torchvision import transforms
|
8 |
import os
|
9 |
|
10 |
-
NUM_ROUNDS =
|
11 |
-
PROB_THRESHOLD = 0.
|
12 |
|
13 |
# Load the model
|
14 |
model = torch.jit.load("SuSy.pt")
|
@@ -72,7 +72,7 @@ class GameState:
|
|
72 |
self.user_score = 0
|
73 |
self.model_score = 0
|
74 |
self.current_round = 0
|
75 |
-
self.total_rounds =
|
76 |
self.game_images = []
|
77 |
self.is_game_active = False
|
78 |
self.last_results = None
|
@@ -88,7 +88,7 @@ def load_images():
|
|
88 |
fake_image_folder = "fake_images"
|
89 |
real_images = [os.path.join(real_image_folder, img) for img in os.listdir(real_image_folder)]
|
90 |
fake_images = [os.path.join(fake_image_folder, img) for img in os.listdir(fake_image_folder)]
|
91 |
-
selected_images = random.sample(real_images,
|
92 |
random.shuffle(selected_images)
|
93 |
return selected_images
|
94 |
|
@@ -151,7 +151,7 @@ def submit_guess(user_guess):
|
|
151 |
correct_answer = "Real" if "real_images" in game_state.game_images[game_state.current_round] else "Fake"
|
152 |
|
153 |
# Determine model's guess based on probabilities
|
154 |
-
model_guess = "Real" if model_prediction['Authentic'] >
|
155 |
|
156 |
# Update scores
|
157 |
if user_guess == correct_answer:
|
@@ -208,8 +208,25 @@ custom_css = """
|
|
208 |
# Define Gradio interface
|
209 |
with gr.Blocks(css=custom_css) as iface:
|
210 |
with gr.Column(elem_id="game-container"):
|
211 |
-
gr.
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
with gr.Row():
|
215 |
with gr.Column(scale=2):
|
|
|
7 |
from torchvision import transforms
|
8 |
import os
|
9 |
|
10 |
+
NUM_ROUNDS = 10 # Adjust the number of game rounds here
|
11 |
+
PROB_THRESHOLD = 0.3 # Adjust the probability threshold for model prediction here
|
12 |
|
13 |
# Load the model
|
14 |
model = torch.jit.load("SuSy.pt")
|
|
|
72 |
self.user_score = 0
|
73 |
self.model_score = 0
|
74 |
self.current_round = 0
|
75 |
+
self.total_rounds = NUM_ROUNDS
|
76 |
self.game_images = []
|
77 |
self.is_game_active = False
|
78 |
self.last_results = None
|
|
|
88 |
fake_image_folder = "fake_images"
|
89 |
real_images = [os.path.join(real_image_folder, img) for img in os.listdir(real_image_folder)]
|
90 |
fake_images = [os.path.join(fake_image_folder, img) for img in os.listdir(fake_image_folder)]
|
91 |
+
selected_images = random.sample(real_images, NUM_ROUNDS / 2) + random.sample(fake_images, NUM_ROUNDS / 2)
|
92 |
random.shuffle(selected_images)
|
93 |
return selected_images
|
94 |
|
|
|
151 |
correct_answer = "Real" if "real_images" in game_state.game_images[game_state.current_round] else "Fake"
|
152 |
|
153 |
# Determine model's guess based on probabilities
|
154 |
+
model_guess = "Real" if model_prediction['Authentic'] > PROB_THRESHOLD else "Fake"
|
155 |
|
156 |
# Update scores
|
157 |
if user_guess == correct_answer:
|
|
|
208 |
# Define Gradio interface
|
209 |
with gr.Blocks(css=custom_css) as iface:
|
210 |
with gr.Column(elem_id="game-container"):
|
211 |
+
gr.HTML("""
|
212 |
+
<table style="border-collapse: collapse; border: none; padding: 20px;">
|
213 |
+
<tr style="border: none;">
|
214 |
+
<td style="border: none; vertical-align: top; padding-right: 30px; padding-left: 30px;">
|
215 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/62f7a16192950415b637e201/NobqlpFbFkTyBi1LsT9JE.png" alt="SuSy Logo" width="120" style="margin-bottom: 10px;">
|
216 |
+
</td>
|
217 |
+
<td style="border: none; vertical-align: top; padding: 10px;">
|
218 |
+
<p style="margin-bottom: 15px;">Compete against SuSy to spot AI-Generated images! SuSy can distinguish between authentic images and those generated by DALL·E, Midjourney and Stable Diffusion.</p>
|
219 |
+
<p style="margin-top: 15px;">Learn more about SuSy: <a href="https://arxiv.org/abs/2409.14128">Present and Future Generalization of Synthetic Image Detectors</a></p>
|
220 |
+
<p style="margin-top: 15px;">
|
221 |
+
Enter the SuSy-verse!
|
222 |
+
<a href="https://huggingface.co/HPAI-BSC/SuSy">Model</a> |
|
223 |
+
<a href="https://github.com/HPAI-BSC/SuSy">Code</a> |
|
224 |
+
<a href="https://huggingface.co/datasets/HPAI-BSC/SuSy-Dataset">Dataset</a>
|
225 |
+
</p>
|
226 |
+
</td>
|
227 |
+
</tr>
|
228 |
+
</table>
|
229 |
+
""")
|
230 |
|
231 |
with gr.Row():
|
232 |
with gr.Column(scale=2):
|
fake_images/bird_003.jpg
ADDED
Git LFS Details
|
fake_images/example_mjv5.jpg
DELETED
Binary file (191 kB)
|
|
fake_images/example_sdxl.jpg
DELETED
Binary file (687 kB)
|
|
fake_images/landscape_002.jpg
ADDED
Git LFS Details
|
fake_images/landscape_004.jpg
ADDED
Git LFS Details
|
fake_images/lighthouse.jpg
ADDED
Git LFS Details
|
fake_images/living-room.jpg
ADDED
Git LFS Details
|
fake_images/man_001.jpg
ADDED
Git LFS Details
|
fake_images/simpsons_002.jpg
ADDED
Git LFS Details
|
fake_images/woman_017.jpg
ADDED
Git LFS Details
|
fake_images/woman_018.jpg
ADDED
Git LFS Details
|
fake_images/woman_021.jpg
ADDED
Git LFS Details
|
real_images/012.jpg
ADDED
Git LFS Details
|
real_images/023.jpg
ADDED
Git LFS Details
|
real_images/030.jpg
ADDED
Git LFS Details
|
real_images/244qppeo8b881.jpg
ADDED
Git LFS Details
|
real_images/26101851686_e4ba08c948_o.jpg
ADDED
Git LFS Details
|
real_images/2ieabkz5smr61.jpg
ADDED
Git LFS Details
|
real_images/example_authentic.jpg
DELETED
Binary file (162 kB)
|
|
real_images/example_dalle3.jpg
DELETED
Binary file (147 kB)
|
|
real_images/oe8tflh3gfx91.jpg
ADDED
Git LFS Details
|
real_images/og2dixbnio5b1.jpg
ADDED
Git LFS Details
|
real_images/ok2rrp8fpvw91.jpg
ADDED
Git LFS Details
|
real_images/sijgfsx7po1a1.jpg
ADDED
Git LFS Details
|