pabberpe commited on
Commit
8500fc9
1 Parent(s): e922e06

Updated Interface + New Images

Browse files
.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: Spot AI-Generated images with SuSy!
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 = 5 # Adjust the number of game rounds here
11
- PROB_THRESHOLD = 0.5 # Adjust the probability threshold for model prediction here
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 = 2
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, 1) + random.sample(fake_images, 1)
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'] > 0.5 else "Fake"
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.Markdown("# Real or Fake Image Challenge")
212
- gr.Markdown("Can you beat the AI at detecting synthetic images?")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

  • SHA256: f10fbf8b5a8086e98eaac190d9ef234460a7e80ddba6fc41fa58fea10c1717cf
  • Pointer size: 132 Bytes
  • Size of remote file: 1.25 MB
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

  • SHA256: 64c6b23af0885e459450a41ac6a57ecc3088181de8c00f1959f65a94667db273
  • Pointer size: 132 Bytes
  • Size of remote file: 3.01 MB
fake_images/landscape_004.jpg ADDED

Git LFS Details

  • SHA256: 6720cc05627962cb981f96dec099f9f9051bbd30de4ebccd7a9b22131f68531d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.72 MB
fake_images/lighthouse.jpg ADDED

Git LFS Details

  • SHA256: d5a09897d787df1ae601afa4d48537c7ca931712679c05a8c23321987dae9935
  • Pointer size: 132 Bytes
  • Size of remote file: 1.9 MB
fake_images/living-room.jpg ADDED

Git LFS Details

  • SHA256: 62bf207137dc742b4c66b0577aefa903d59cc26d8808bb718c0c33fe0873ba26
  • Pointer size: 132 Bytes
  • Size of remote file: 1.7 MB
fake_images/man_001.jpg ADDED

Git LFS Details

  • SHA256: fa9fdb22c09939a91debabd26cdacf72997327fa6ac817c8ad39724223d67957
  • Pointer size: 131 Bytes
  • Size of remote file: 451 kB
fake_images/simpsons_002.jpg ADDED

Git LFS Details

  • SHA256: 814d50f07ab4c922ac9da4482db2659117d4506ee4e72b4fa7afed022ea36bd0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.23 MB
fake_images/woman_017.jpg ADDED

Git LFS Details

  • SHA256: 996ec290e044b84aba06487a7ba5549a9a0ed3686fe63a31e555461f9ede85a6
  • Pointer size: 131 Bytes
  • Size of remote file: 513 kB
fake_images/woman_018.jpg ADDED

Git LFS Details

  • SHA256: aeb7c01209433ae056b83fd2aba2c6ae8401ce75118e6f51073d336f677e4820
  • Pointer size: 131 Bytes
  • Size of remote file: 337 kB
fake_images/woman_021.jpg ADDED

Git LFS Details

  • SHA256: 19a5f8d27ba2f34d4394507000d7ae137e2fab72adad94d14e052a438d7b9861
  • Pointer size: 132 Bytes
  • Size of remote file: 1.94 MB
real_images/012.jpg ADDED

Git LFS Details

  • SHA256: 5ab25c30e6ef9ee840bf249620f246ecb9f6ef56cb6bd83d104974de0830328f
  • Pointer size: 131 Bytes
  • Size of remote file: 943 kB
real_images/023.jpg ADDED

Git LFS Details

  • SHA256: 765151ec84d7bcdcacb7a1cfb41606b79fb49fc7e6e13da87941f3d98b59af2f
  • Pointer size: 131 Bytes
  • Size of remote file: 535 kB
real_images/030.jpg ADDED

Git LFS Details

  • SHA256: d8d614ee5e8d0e228484e480aea85fac54be1e38d3a51a89f746fa92ab360435
  • Pointer size: 132 Bytes
  • Size of remote file: 1.91 MB
real_images/244qppeo8b881.jpg ADDED

Git LFS Details

  • SHA256: 8e1eadd80b0b852b1058d0b4f27c89274366bb2388d56764879a99dc1171b2a5
  • Pointer size: 131 Bytes
  • Size of remote file: 439 kB
real_images/26101851686_e4ba08c948_o.jpg ADDED

Git LFS Details

  • SHA256: 4b6c26b5a4857a816846a93794b64114f325d27244110f4814c5531b22a3872a
  • Pointer size: 132 Bytes
  • Size of remote file: 3.48 MB
real_images/2ieabkz5smr61.jpg ADDED

Git LFS Details

  • SHA256: 4c6e9a0c621c2b8ce0695a323b2842a7ed93ca4454a27a21a25faf3e56960e6a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.66 MB
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

  • SHA256: 5e65ea5f3dbe99bbe96d3c0d5c23f5f01765bbc763a0fe02d8747851fb4152a8
  • Pointer size: 131 Bytes
  • Size of remote file: 506 kB
real_images/og2dixbnio5b1.jpg ADDED

Git LFS Details

  • SHA256: 1e9cd2bc1ab600826db426cda5887beacaad8d47e2ee6c2a3ebfd7cad5e3cfde
  • Pointer size: 131 Bytes
  • Size of remote file: 217 kB
real_images/ok2rrp8fpvw91.jpg ADDED

Git LFS Details

  • SHA256: 54f4bd8de42216e9ffad4c82cb42ec3fe9cec65efbf4537b2851098b5a048635
  • Pointer size: 132 Bytes
  • Size of remote file: 2.64 MB
real_images/sijgfsx7po1a1.jpg ADDED

Git LFS Details

  • SHA256: 7bb5e8b915d8a12029207ba19b8dac101394c91a8de18319853bd6704fdc3135
  • Pointer size: 132 Bytes
  • Size of remote file: 1 MB