Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,35 +12,63 @@ def predict(input_img):
|
|
12 |
predictions = pipe(input_img)
|
13 |
return input_img, {p["label"]: p["score"] for p in predictions}
|
14 |
|
15 |
-
#
|
16 |
model_card = """
|
17 |
---
|
18 |
|
19 |
-
## 🧠 Model Description / 模型簡介
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
It classifies face images into two categories: **AI-generated** and **Not AI-generated**.
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
🔗 [View on Hugging Face 模型主頁](https://huggingface.co/hchcsuim/FaceAIorNot)
|
27 |
|
28 |
### 📊 Evaluation Results / 模型評估
|
29 |
|
30 |
-
- Accuracy 準確率: **99.35%**
|
31 |
-
- Precision 精確率: **99.25%**
|
32 |
-
- Recall 召回率: **99.47%**
|
33 |
-
- F1-score
|
34 |
-
- Loss
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
###
|
|
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
|
|
44 |
"""
|
45 |
|
46 |
# Gradio 介面設定(雙語版)
|
@@ -51,10 +79,10 @@ gradio_app = gr.Interface(
|
|
51 |
gr.Image(label="🖼️ Input Image / 輸入圖片"),
|
52 |
gr.Label(label="🔍 Classification Result / 判斷結果", num_top_classes=2)
|
53 |
],
|
54 |
-
title="FaceAIorNot | 真人臉,還是 AI
|
55 |
description=(
|
56 |
"🤖 Upload or take a face photo to see if it's AI-generated or real.\n"
|
57 |
-
"🧑 上傳或拍攝一張臉部照片,判斷是真人還是 AI
|
58 |
),
|
59 |
article=model_card,
|
60 |
allow_flagging="never"
|
|
|
12 |
predictions = pipe(input_img)
|
13 |
return input_img, {p["label"]: p["score"] for p in predictions}
|
14 |
|
15 |
+
# 精簡中英文對照版說明
|
16 |
model_card = """
|
17 |
---
|
18 |
|
19 |
+
## 🧠 Model Description / 模型簡介
|
20 |
+
This model classifies face images into two categories: **AI-generated** and **Not AI-generated**.
|
21 |
+
本模型將臉部圖片分類為「AI生成」或「非AI生成」。
|
22 |
|
23 |
+
🔗 Model Homepage / 模型主頁:https://huggingface.co/hchcsuim/FaceAIorNot
|
|
|
24 |
|
25 |
+
---
|
|
|
|
|
26 |
|
27 |
### 📊 Evaluation Results / 模型評估
|
28 |
|
29 |
+
- Accuracy 準確率: **99.35%**
|
30 |
+
- Precision 精確率: **99.25%**
|
31 |
+
- Recall 召回率: **99.47%**
|
32 |
+
- F1-score F1 分數: **99.36%**
|
33 |
+
- Loss 損失: **0.0233**
|
34 |
+
|
35 |
+
Dataset: 105,330 face images (50% real / 50% AI), from 17 datasets, 14 generation techniques, 90% train / 10% test
|
36 |
+
資料集共 105,330 張臉部圖片(50% 真人 / 50% AI),來自 17 個資料集、14 種生成技術,90% 訓練 / 10% 測試
|
37 |
+
|
38 |
+
---
|
39 |
+
|
40 |
+
### ⚠️ Disclaimer / 免責聲明
|
41 |
+
This model is for research and educational use only. Not 100% accurate.
|
42 |
+
請僅用於研究與教育用途,結果非百分之百準確。
|
43 |
|
44 |
+
Do not use for identity verification, legal judgment, or public exposure.
|
45 |
+
請勿用於身分驗證、法律判斷或公開揭露等用途。
|
46 |
+
|
47 |
+
---
|
48 |
|
49 |
+
### 👨💻 About the Developer / 關於開發者
|
50 |
+
**Hung Chih Hsiang(洪誌翔)**
|
51 |
+
Master’s student in Information Management, Cheng Shiu University.
|
52 |
+
正修科技大學 資訊管理所碩士生。
|
53 |
|
54 |
+
Focus: deepfake detection, snake recognition, system development, DevOps
|
55 |
+
專長:深度偽造辨識、蛇類辨識、系統開發與運維
|
56 |
+
|
57 |
+
---
|
58 |
+
|
59 |
+
### 🤝 Open to Collaborations / 歡迎合作
|
60 |
+
|
61 |
+
I'm open to:
|
62 |
+
我歡迎以下方向的合作:
|
63 |
+
|
64 |
+
- Research or commercial AI projects / AI 研究或商業應用
|
65 |
+
- Model training, optimization, deployment / 模型訓練、優化與部署
|
66 |
+
- System development, MLOps & DevOps / 系統開發與 MLOps、DevOps 整合
|
67 |
+
|
68 |
+
---
|
69 |
|
70 |
+
📧 Email: [email protected]
|
71 |
+
🐙 GitHub: https://github.com/hchcsuim
|
72 |
"""
|
73 |
|
74 |
# Gradio 介面設定(雙語版)
|
|
|
79 |
gr.Image(label="🖼️ Input Image / 輸入圖片"),
|
80 |
gr.Label(label="🔍 Classification Result / 判斷結果", num_top_classes=2)
|
81 |
],
|
82 |
+
title="FaceAIorNot | 真人臉,還是 AI 生成人臉?",
|
83 |
description=(
|
84 |
"🤖 Upload or take a face photo to see if it's AI-generated or real.\n"
|
85 |
+
"🧑 上傳或拍攝一張臉部照片,判斷是真人還是 AI 生成圖。"
|
86 |
),
|
87 |
article=model_card,
|
88 |
allow_flagging="never"
|