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