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
Update README.md
Browse files1 unmodified line23456787 unmodified lines1617181 unmodified linelicense: apache-2.0datasets:- anson-huang/mirage-news---```pyClassification Report:precision recall f1-score support7 unmodified lines```1 unmodified line2345678910111213141516171819202122232425267 unmodified lines3435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061 unmodified linelicense: apache-2.0datasets:- anson-huang/mirage-newslanguage:- enbase_model:- google/siglip2-base-patch16-224pipeline_tag: image-classificationlibrary_name: transformerstags:- Fake- Real- SigLIP2- Mirage---# **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.```pyClassification Report:precision recall f1-score support7 unmodified lines```The model categorizes images into two classes:- **Class 0:** Real- **Class 1:** Fake---# **Run with Transformers 🤗**```python!pip install -q transformers torch pillow gradio``````pythonimport gradio as grfrom transformers import AutoImageProcessorfrom transformers import SiglipForImageClassificationfrom PIL import Imageimport torch# Load model and processormodel_name = "prithivMLmods/Mirage-Photo-Classifier"model = SiglipForImageClassification.from_pretrained(model_name)processor = AutoImageProcessor.from_pretrained(model_name)# Label mappinglabels = {"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.logitsprobs = 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 interfaceiface = 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 appif __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.
README.md+88