Spaces:
Runtime error
Runtime error
fix(ui bugs)
Browse files
app.py
CHANGED
|
@@ -42,6 +42,28 @@ def softmax(vector):
|
|
| 42 |
e = np.exp(vector - np.max(vector)) # for numerical stability
|
| 43 |
return e / e.sum()
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
def convert_pil_to_bytes(image, format='JPEG'):
|
| 46 |
img_byte_arr = io.BytesIO()
|
| 47 |
image.save(img_byte_arr, format=format)
|
|
@@ -184,6 +206,13 @@ def predict_image(img, confidence_threshold):
|
|
| 184 |
except Exception as e:
|
| 185 |
label_5 = f"Error: {str(e)}"
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
# Combine results
|
| 188 |
combined_results = {
|
| 189 |
"SwinV2/detect": label_1,
|
|
@@ -192,8 +221,12 @@ def predict_image(img, confidence_threshold):
|
|
| 192 |
"Swin/SDXL-FLUX": label_4,
|
| 193 |
"GOAT": label_5
|
| 194 |
}
|
|
|
|
|
|
|
| 195 |
combined_outputs = [ result_1output, result_2output, result_3output, result_4output, result_5output ]
|
| 196 |
-
|
|
|
|
|
|
|
| 197 |
|
| 198 |
# Define a function to generate the HTML content
|
| 199 |
# Define a function to generate the HTML content
|
|
@@ -220,12 +253,12 @@ def generate_results_html(results):
|
|
| 220 |
<div class="grid xl:grid-cols-5 md:grid-cols-5 grid-cols-1 gap-1">
|
| 221 |
<!-- Tile 1: SwinV2/detect -->
|
| 222 |
<div
|
| 223 |
-
class="flex flex-col bg-
|
| 224 |
<div
|
| 225 |
class="-m-4 h-24 {get_header_color(results[0][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg">
|
| 226 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 1:</span>
|
| 227 |
<span
|
| 228 |
-
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[0][-1])[2]} px-
|
| 229 |
>
|
| 230 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 231 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[0][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
@@ -245,7 +278,7 @@ def generate_results_html(results):
|
|
| 245 |
</div>
|
| 246 |
<div class="relative -mx-4 bg-gray-800">
|
| 247 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 248 |
-
<div class="bg-red-400 h-full rounded-none" style="width: {results[0][3] * 100:.2f}%;">
|
| 249 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 250 |
<span class="ml-1 font-medium font-mono">{results[0][3]:.4f}</span>
|
| 251 |
</p>
|
|
@@ -255,20 +288,20 @@ def generate_results_html(results):
|
|
| 255 |
</div>
|
| 256 |
<div class="flex flex-col items-start">
|
| 257 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">SwinV2 Based</h4>
|
| 258 |
-
|
| 259 |
<div class="text-xs font-mono">Real: {results[0][2]:.4f}, AI: {results[0][3]:.4f}</div>
|
| 260 |
-
|
| 261 |
<a class="mt-2 text-[0.66rem] tracking-wide">@haywoodsloan / more info</a>
|
| 262 |
</div>
|
| 263 |
</div>
|
| 264 |
<!-- Tile 2: ViT/AI-vs-Real -->
|
| 265 |
<div
|
| 266 |
-
class="flex flex-col bg-
|
| 267 |
<div
|
| 268 |
class="-m-4 h-24 {get_header_color(results[1][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[1][-1])[4]}">
|
| 269 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 2</span>
|
| 270 |
<span
|
| 271 |
-
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[1][-1])[2]} px-
|
| 272 |
>
|
| 273 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 274 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[1][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
@@ -288,7 +321,7 @@ def generate_results_html(results):
|
|
| 288 |
</div>
|
| 289 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 290 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 291 |
-
<div class="bg-red-400 h-full rounded-none" style="width: {results[1][3] * 100:.2f}%;">
|
| 292 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 293 |
<span class="ml-1 font-medium font-mono">{results[1][3]:.4f}</span>
|
| 294 |
</p>
|
|
@@ -298,20 +331,20 @@ def generate_results_html(results):
|
|
| 298 |
</div>
|
| 299 |
<div class="flex flex-col items-start">
|
| 300 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">ViT Based</h4>
|
| 301 |
-
|
| 302 |
<div class="text-xs font-mono">Real: {results[1][2]:.4f}, AI: {results[1][3]:.4f}</div>
|
| 303 |
-
|
| 304 |
<a class="mt-2 text-[0.66rem] tracking-wide">@Heem2 / more info</a>
|
| 305 |
</div>
|
| 306 |
</div>
|
| 307 |
<!-- Tile 3: Swin/SDXL -->
|
| 308 |
<div
|
| 309 |
-
class="flex flex-col bg-
|
| 310 |
<div
|
| 311 |
class="-m-4 h-24 {get_header_color(results[2][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[2][-1])[4]}">
|
| 312 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 3</span>
|
| 313 |
<span
|
| 314 |
-
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[2][-1])[2]} px-
|
| 315 |
>
|
| 316 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 317 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[2][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
@@ -331,7 +364,7 @@ def generate_results_html(results):
|
|
| 331 |
</div>
|
| 332 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 333 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 334 |
-
<div class="bg-red-400 h-full rounded-none" style="width: {results[2][3] * 100:.2f}%;">
|
| 335 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 336 |
<span class="ml-1 font-medium font-mono">{results[2][3]:.4f}</span>
|
| 337 |
</p>
|
|
@@ -341,20 +374,20 @@ def generate_results_html(results):
|
|
| 341 |
</div>
|
| 342 |
<div class="flex flex-col items-start">
|
| 343 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">Swin Based</h4>
|
| 344 |
-
|
| 345 |
<div class="text-xs font-mono">Real: {results[2][2]:.4f}, AI: {results[2][3]:.4f}</div>
|
| 346 |
-
|
| 347 |
<a class="mt-2 text-[0.66rem] tracking-wide">@Organika / more info</a>
|
| 348 |
</div>
|
| 349 |
</div>
|
| 350 |
<!-- Tile 4: Swin/SDXL-FLUX -->
|
| 351 |
<div
|
| 352 |
-
class="flex flex-col bg-
|
| 353 |
<div
|
| 354 |
class="-m-4 h-24 {get_header_color(results[3][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[3][-1])[4]}">
|
| 355 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 4:</span>
|
| 356 |
<span
|
| 357 |
-
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[3][-1])[2]} px-
|
| 358 |
>
|
| 359 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 360 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[3][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
@@ -374,7 +407,7 @@ def generate_results_html(results):
|
|
| 374 |
</div>
|
| 375 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 376 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 377 |
-
<div class="bg-red-400 h-full rounded-none" style="width: {results[3][3] * 100:.2f}%;">
|
| 378 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 379 |
<span class="ml-1 font-medium font-mono">{results[3][3]:.4f}</span>
|
| 380 |
</p>
|
|
@@ -384,20 +417,20 @@ def generate_results_html(results):
|
|
| 384 |
</div>
|
| 385 |
<div class="flex flex-col items-start">
|
| 386 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">Swin Based</h4>
|
| 387 |
-
|
| 388 |
<div class="text-xs font-mono">Real: {results[3][2]:.4f}, AI: {results[3][3]:.4f}</div>
|
| 389 |
-
|
| 390 |
<a class="mt-2 text-[0.66rem] tracking-wide">@cmckinle / more info</a>
|
| 391 |
</div>
|
| 392 |
</div>
|
| 393 |
<!-- Tile 5: GOAT -->
|
| 394 |
<div
|
| 395 |
-
class="flex flex-col bg-
|
| 396 |
<div
|
| 397 |
class="-m-4 h-24 {get_header_color(results[4][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[4][-1])[4]}">
|
| 398 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 5: {results[4][1]}</span>
|
| 399 |
<span
|
| 400 |
-
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[4][-1])[2]} px-
|
| 401 |
>
|
| 402 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 403 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[4][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
@@ -417,7 +450,7 @@ def generate_results_html(results):
|
|
| 417 |
</div>
|
| 418 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 419 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 420 |
-
<div class="bg-red-400 h-full rounded-none" style="width: {results[4][3] * 100:.2f}%;">
|
| 421 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 422 |
<span class="ml-1 font-medium font-mono">{results[4][3]:.4f}</span>
|
| 423 |
</p>
|
|
@@ -427,9 +460,9 @@ def generate_results_html(results):
|
|
| 427 |
</div>
|
| 428 |
<div class="flex flex-col items-start">
|
| 429 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">GOAT Model</h4>
|
| 430 |
-
|
| 431 |
<div class="text-xs font-mono">Real: {results[4][2]:.4f}, AI: {results[4][3]:.4f}</div>
|
| 432 |
-
|
| 433 |
<a class="mt-2 text-[0.66rem] tracking-wide">@GOAT / more info</a>
|
| 434 |
</div>
|
| 435 |
</div>
|
|
|
|
| 42 |
e = np.exp(vector - np.max(vector)) # for numerical stability
|
| 43 |
return e / e.sum()
|
| 44 |
|
| 45 |
+
def augment_image(img_pil):
|
| 46 |
+
# Example augmentation: horizontal flip
|
| 47 |
+
transform_flip = transforms.Compose([
|
| 48 |
+
transforms.RandomHorizontalFlip(p=1.0) # Flip the image horizontally with probability 1.0
|
| 49 |
+
])
|
| 50 |
+
|
| 51 |
+
# Example augmentation: rotation
|
| 52 |
+
transform_rotate = transforms.Compose([
|
| 53 |
+
transforms.RandomRotation(degrees=(90, 90)) # Rotate the image by 90 degrees
|
| 54 |
+
])
|
| 55 |
+
|
| 56 |
+
augmented_img_flip = transform_flip(img_pil)
|
| 57 |
+
augmented_img_rotate = transform_rotate(img_pil)
|
| 58 |
+
|
| 59 |
+
return augmented_img_flip, augmented_img_rotate
|
| 60 |
+
|
| 61 |
+
# def convert_pil_to_bytes(img_pil):
|
| 62 |
+
# img_byte_arr = io.BytesIO()
|
| 63 |
+
# img_pil.save(img_byte_arr, format='PNG')
|
| 64 |
+
# img_byte_arr = img_byte_arr.getvalue()
|
| 65 |
+
# return img_byte_arr
|
| 66 |
+
|
| 67 |
def convert_pil_to_bytes(image, format='JPEG'):
|
| 68 |
img_byte_arr = io.BytesIO()
|
| 69 |
image.save(img_byte_arr, format=format)
|
|
|
|
| 206 |
except Exception as e:
|
| 207 |
label_5 = f"Error: {str(e)}"
|
| 208 |
|
| 209 |
+
# Generate augmented images
|
| 210 |
+
augmented_img_flip, augmented_img_rotate = augment_image(img_pil)
|
| 211 |
+
|
| 212 |
+
# Convert augmented images to bytes for display
|
| 213 |
+
augmented_img_flip_bytes = convert_pil_to_bytes(augmented_img_flip)
|
| 214 |
+
augmented_img_rotate_bytes = convert_pil_to_bytes(augmented_img_rotate)
|
| 215 |
+
|
| 216 |
# Combine results
|
| 217 |
combined_results = {
|
| 218 |
"SwinV2/detect": label_1,
|
|
|
|
| 221 |
"Swin/SDXL-FLUX": label_4,
|
| 222 |
"GOAT": label_5
|
| 223 |
}
|
| 224 |
+
# Generate HTML content
|
| 225 |
+
|
| 226 |
combined_outputs = [ result_1output, result_2output, result_3output, result_4output, result_5output ]
|
| 227 |
+
html_content = generate_results_html(combined_outputs)
|
| 228 |
+
|
| 229 |
+
return img_pil, combined_outputs, html_content, augmented_img_flip_bytes, augmented_img_rotate_bytes
|
| 230 |
|
| 231 |
# Define a function to generate the HTML content
|
| 232 |
# Define a function to generate the HTML content
|
|
|
|
| 253 |
<div class="grid xl:grid-cols-5 md:grid-cols-5 grid-cols-1 gap-1">
|
| 254 |
<!-- Tile 1: SwinV2/detect -->
|
| 255 |
<div
|
| 256 |
+
class="flex flex-col bg-gray-800 rounded-sm p-4 m-1 border border-gray-800 shadow-xs transition hover:shadow-lg dark:shadow-gray-700/25">
|
| 257 |
<div
|
| 258 |
class="-m-4 h-24 {get_header_color(results[0][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg">
|
| 259 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 1:</span>
|
| 260 |
<span
|
| 261 |
+
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[0][-1])[2]} px-1 py-0.5 {get_header_color(results[0][-1])[3]}"
|
| 262 |
>
|
| 263 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 264 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[0][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
|
|
| 278 |
</div>
|
| 279 |
<div class="relative -mx-4 bg-gray-800">
|
| 280 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 281 |
+
<div class="inline-flex bg-red-400 h-full rounded-none" style="width: {results[0][3] * 100:.2f}%;">
|
| 282 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 283 |
<span class="ml-1 font-medium font-mono">{results[0][3]:.4f}</span>
|
| 284 |
</p>
|
|
|
|
| 288 |
</div>
|
| 289 |
<div class="flex flex-col items-start">
|
| 290 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">SwinV2 Based</h4>
|
| 291 |
+
|
| 292 |
<div class="text-xs font-mono">Real: {results[0][2]:.4f}, AI: {results[0][3]:.4f}</div>
|
| 293 |
+
|
| 294 |
<a class="mt-2 text-[0.66rem] tracking-wide">@haywoodsloan / more info</a>
|
| 295 |
</div>
|
| 296 |
</div>
|
| 297 |
<!-- Tile 2: ViT/AI-vs-Real -->
|
| 298 |
<div
|
| 299 |
+
class="flex flex-col bg-gray-800 rounded-sm p-4 m-1 border border-gray-800 shadow-xs transition hover:shadow-lg dark:shadow-gray-700/25">
|
| 300 |
<div
|
| 301 |
class="-m-4 h-24 {get_header_color(results[1][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[1][-1])[4]}">
|
| 302 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 2</span>
|
| 303 |
<span
|
| 304 |
+
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[1][-1])[2]} px-1 py-0.5 {get_header_color(results[1][-1])[3]}"
|
| 305 |
>
|
| 306 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 307 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[1][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
|
|
| 321 |
</div>
|
| 322 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 323 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 324 |
+
<div class="inline-flex bg-red-400 h-full rounded-none" style="width: {results[1][3] * 100:.2f}%;">
|
| 325 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 326 |
<span class="ml-1 font-medium font-mono">{results[1][3]:.4f}</span>
|
| 327 |
</p>
|
|
|
|
| 331 |
</div>
|
| 332 |
<div class="flex flex-col items-start">
|
| 333 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">ViT Based</h4>
|
| 334 |
+
|
| 335 |
<div class="text-xs font-mono">Real: {results[1][2]:.4f}, AI: {results[1][3]:.4f}</div>
|
| 336 |
+
|
| 337 |
<a class="mt-2 text-[0.66rem] tracking-wide">@Heem2 / more info</a>
|
| 338 |
</div>
|
| 339 |
</div>
|
| 340 |
<!-- Tile 3: Swin/SDXL -->
|
| 341 |
<div
|
| 342 |
+
class="flex flex-col bg-gray-800 rounded-sm p-4 m-1 border border-gray-800 shadow-xs transition hover:shadow-lg dark:shadow-gray-700/25">
|
| 343 |
<div
|
| 344 |
class="-m-4 h-24 {get_header_color(results[2][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[2][-1])[4]}">
|
| 345 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 3</span>
|
| 346 |
<span
|
| 347 |
+
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[2][-1])[2]} px-1 py-0.5 {get_header_color(results[2][-1])[3]}"
|
| 348 |
>
|
| 349 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 350 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[2][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
|
|
| 364 |
</div>
|
| 365 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 366 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 367 |
+
<div class="inline-flex bg-red-400 h-full rounded-none" style="width: {results[2][3] * 100:.2f}%;">
|
| 368 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 369 |
<span class="ml-1 font-medium font-mono">{results[2][3]:.4f}</span>
|
| 370 |
</p>
|
|
|
|
| 374 |
</div>
|
| 375 |
<div class="flex flex-col items-start">
|
| 376 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">Swin Based</h4>
|
| 377 |
+
|
| 378 |
<div class="text-xs font-mono">Real: {results[2][2]:.4f}, AI: {results[2][3]:.4f}</div>
|
| 379 |
+
|
| 380 |
<a class="mt-2 text-[0.66rem] tracking-wide">@Organika / more info</a>
|
| 381 |
</div>
|
| 382 |
</div>
|
| 383 |
<!-- Tile 4: Swin/SDXL-FLUX -->
|
| 384 |
<div
|
| 385 |
+
class="flex flex-col bg-gray-800 rounded-sm p-4 m-1 border border-gray-800 shadow-xs transition hover:shadow-lg dark:shadow-gray-700/25">
|
| 386 |
<div
|
| 387 |
class="-m-4 h-24 {get_header_color(results[3][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[3][-1])[4]}">
|
| 388 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 4:</span>
|
| 389 |
<span
|
| 390 |
+
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[3][-1])[2]} px-1 py-0.5 {get_header_color(results[3][-1])[3]}"
|
| 391 |
>
|
| 392 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 393 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[3][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
|
|
| 407 |
</div>
|
| 408 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 409 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 410 |
+
<div class="inline-flex bg-red-400 h-full rounded-none" style="width: {results[3][3] * 100:.2f}%;">
|
| 411 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 412 |
<span class="ml-1 font-medium font-mono">{results[3][3]:.4f}</span>
|
| 413 |
</p>
|
|
|
|
| 417 |
</div>
|
| 418 |
<div class="flex flex-col items-start">
|
| 419 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">Swin Based</h4>
|
| 420 |
+
|
| 421 |
<div class="text-xs font-mono">Real: {results[3][2]:.4f}, AI: {results[3][3]:.4f}</div>
|
| 422 |
+
|
| 423 |
<a class="mt-2 text-[0.66rem] tracking-wide">@cmckinle / more info</a>
|
| 424 |
</div>
|
| 425 |
</div>
|
| 426 |
<!-- Tile 5: GOAT -->
|
| 427 |
<div
|
| 428 |
+
class="flex flex-col bg-gray-800 rounded-sm p-4 m-1 border border-gray-800 shadow-xs transition hover:shadow-lg dark:shadow-gray-700/25">
|
| 429 |
<div
|
| 430 |
class="-m-4 h-24 {get_header_color(results[4][-1])[0]} rounded-sm rounded-b-none transition border group-hover:border-gray-100 group-hover:shadow-lg group-hover:{get_header_color(results[4][-1])[4]}">
|
| 431 |
<span class="text-gray-300 font-mono tracking-widest p-4 pb-3 block text-xs text-center">MODEL 5: {results[4][1]}</span>
|
| 432 |
<span
|
| 433 |
+
class="flex w-24 mx-auto tracking-wide items-center justify-center rounded-full {get_header_color(results[4][-1])[2]} px-1 py-0.5 {get_header_color(results[4][-1])[3]}"
|
| 434 |
>
|
| 435 |
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="size-5 mr-2 -ml-3 group-hover:animate group-hover:animate-pulse">
|
| 436 |
{'<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />' if results[4][-1] == 'REAL' else '<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />'}
|
|
|
|
| 450 |
</div>
|
| 451 |
<div class="mt-4 relative -mx-4 bg-gray-800">
|
| 452 |
<div class="w-full bg-gray-400 rounded-none h-8">
|
| 453 |
+
<div class="inline-flex bg-red-400 h-full rounded-none" style="width: {results[4][3] * 100:.2f}%;">
|
| 454 |
<p class="p-2 px-4 text-xs self-center align-middle">Conf:
|
| 455 |
<span class="ml-1 font-medium font-mono">{results[4][3]:.4f}</span>
|
| 456 |
</p>
|
|
|
|
| 460 |
</div>
|
| 461 |
<div class="flex flex-col items-start">
|
| 462 |
<h4 class="mt-4 text-sm font-semibold tracking-wide">GOAT Model</h4>
|
| 463 |
+
|
| 464 |
<div class="text-xs font-mono">Real: {results[4][2]:.4f}, AI: {results[4][3]:.4f}</div>
|
| 465 |
+
|
| 466 |
<a class="mt-2 text-[0.66rem] tracking-wide">@GOAT / more info</a>
|
| 467 |
</div>
|
| 468 |
</div>
|