hudaakram commited on
Commit
94f3b39
·
verified ·
1 Parent(s): a8d47df

Deploy FaceGuard demo with proper README config

Browse files
Files changed (2) hide show
  1. README.md +11 -2
  2. app.py +0 -1
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # FaceGuard – ViT (20 CelebA IDs)
2
 
3
  A lightweight face-identity classifier demo.
@@ -13,10 +24,8 @@ This Space lets you upload a face crop and see **Top-5 predicted identities**.
13
  *Note:* CelebA identities are anonymous integer IDs (e.g., 8968), not real names.
14
 
15
  ## Visuals
16
- If training artifacts were produced in Colab, they’re included below:
17
  ![Confusion Matrix](./confusion_matrix_test.png)
18
  ![ROC Curves](./roc_curves_test.png)
19
 
20
  ## Tech
21
  - 🤗 Transformers (ViT), 🤗 Datasets, Gradio UI
22
- - Collator-based preprocessing (no `with_transform`) for robust vision batching
 
1
+ ---
2
+ title: FaceGuard – ViT Demo
3
+ emoji: 🎭
4
+ colorFrom: indigo
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: "4.0.0"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
  # FaceGuard – ViT (20 CelebA IDs)
13
 
14
  A lightweight face-identity classifier demo.
 
24
  *Note:* CelebA identities are anonymous integer IDs (e.g., 8968), not real names.
25
 
26
  ## Visuals
 
27
  ![Confusion Matrix](./confusion_matrix_test.png)
28
  ![ROC Curves](./roc_curves_test.png)
29
 
30
  ## Tech
31
  - 🤗 Transformers (ViT), 🤗 Datasets, Gradio UI
 
app.py CHANGED
@@ -21,7 +21,6 @@ def predict_top5(img: Image.Image):
21
  logits = model(pixel_values=enc["pixel_values"]).logits
22
  probs = torch.softmax(logits, dim=-1).squeeze(0).cpu().numpy()
23
  top5 = probs.argsort()[-5:][::-1] # indices of Top-5 classes
24
- # Gradio Label expects a dict of {display_name: score}
25
  return {f"label {i} (celeb_id {id2label[i]})": float(probs[i]) for i in top5}
26
 
27
  desc = (
 
21
  logits = model(pixel_values=enc["pixel_values"]).logits
22
  probs = torch.softmax(logits, dim=-1).squeeze(0).cpu().numpy()
23
  top5 = probs.argsort()[-5:][::-1] # indices of Top-5 classes
 
24
  return {f"label {i} (celeb_id {id2label[i]})": float(probs[i]) for i in top5}
25
 
26
  desc = (