Run this model with HF Jobs
Run prithivMLmods/Mirage-Photo-Classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/prithivMLmods/Mirage-Photo-Classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/prithivMLmods/Mirage-Photo-Classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use prithivMLmods/Mirage-Photo-Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Mirage-Photo-Classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="prithivMLmods/Mirage-Photo-Classifier") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForImageClassification processor = AutoProcessor.from_pretrained("prithivMLmods/Mirage-Photo-Classifier") model = AutoModelForImageClassification.from_pretrained("prithivMLmods/Mirage-Photo-Classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Mirage-Photo-Classifier
Mirage-Photo-Classifier is an image classification vision-language encoder model fine-tuned from google/siglip2-base-patch16-224 for a binary image authenticity classification task. It is designed to determine whether an image is real or AI-generated (fake) using the SiglipForImageClassification architecture.
Classification Report:
precision recall f1-score support
Real 0.9781 0.9132 0.9446 5000
Fake 0.9186 0.9796 0.9481 5000
accuracy 0.9464 10000
macro avg 0.9484 0.9464 0.9463 10000
weighted avg 0.9484 0.9464 0.9463 10000
The model categorizes images into two classes:
- Class 0: Real
- Class 1: Fake
Run with Transformers π€
!pip install -q transformers torch pillow gradio
import gradio as gr
from transformers import AutoImageProcessor
from transformers import SiglipForImageClassification
from PIL import Image
import torch
# Load model and processor
model_name = "prithivMLmods/Mirage-Photo-Classifier"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
# Label mapping
labels = {
"0": "Real",
"1": "Fake"
}
def classify_image_authenticity(image):
"""Predicts whether the image is real or AI-generated (fake)."""
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
return predictions
# Gradio interface
iface = gr.Interface(
fn=classify_image_authenticity,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(label="Prediction Scores"),
title="Mirage Photo Classifier",
description="Upload an image to determine if it's Real or AI-generated (Fake)."
)
# Launch the app
if __name__ == "__main__":
iface.launch()
Intended Use
The Mirage-Photo-Classifier model is designed to detect whether an image is genuine (photograph) or synthetically generated. Use cases include:
- AI Image Detection: Identifying AI-generated images in social media, news, or datasets.
- Digital Forensics: Helping professionals detect image authenticity in investigations.
- Platform Moderation: Assisting content platforms in labeling generated content.
- Dataset Validation: Cleaning and verifying training data for other AI models.
- Downloads last month
- 116
Model tree for prithivMLmods/Mirage-Photo-Classifier
Base model
google/siglip2-base-patch16-224
