Spaces:
Running
Running
Ashish Ranjan Karn
commited on
Commit
·
dd849f5
1
Parent(s):
a304836
init 2
Browse files
README.md
CHANGED
|
@@ -16,7 +16,7 @@ Detect whether an image is AI-generated or real using state-of-the-art machine l
|
|
| 16 |
|
| 17 |
## Overview
|
| 18 |
|
| 19 |
-
This Gradio app uses
|
| 20 |
|
| 21 |
- DALL-E
|
| 22 |
- Midjourney
|
|
@@ -31,7 +31,6 @@ This Gradio app uses the [Organika/sdxl-detector](https://huggingface.co/Organik
|
|
| 31 |
|
| 32 |
## Model Information
|
| 33 |
|
| 34 |
-
- **Model**: [Organika/sdxl-detector](https://huggingface.co/Organika/sdxl-detector)
|
| 35 |
- **Task**: Image Classification (Binary: AI-generated vs Real)
|
| 36 |
- **Framework**: Transformers + PyTorch
|
| 37 |
- **Interface**: Gradio
|
|
@@ -46,7 +45,7 @@ This Gradio app uses the [Organika/sdxl-detector](https://huggingface.co/Organik
|
|
| 46 |
|
| 47 |
## Technical Details
|
| 48 |
|
| 49 |
-
The app uses
|
| 50 |
|
| 51 |
## Development
|
| 52 |
|
|
|
|
| 16 |
|
| 17 |
## Overview
|
| 18 |
|
| 19 |
+
This Gradio app uses a specialized model to classify images as either AI-generated or real. The model has been specifically trained to detect images generated by various AI systems including:
|
| 20 |
|
| 21 |
- DALL-E
|
| 22 |
- Midjourney
|
|
|
|
| 31 |
|
| 32 |
## Model Information
|
| 33 |
|
|
|
|
| 34 |
- **Task**: Image Classification (Binary: AI-generated vs Real)
|
| 35 |
- **Framework**: Transformers + PyTorch
|
| 36 |
- **Interface**: Gradio
|
|
|
|
| 45 |
|
| 46 |
## Technical Details
|
| 47 |
|
| 48 |
+
The app uses direct model inference to provide robust classification results. The model outputs probabilities for each class, giving you confidence scores for the prediction.
|
| 49 |
|
| 50 |
## Development
|
| 51 |
|
app.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import
|
| 3 |
|
| 4 |
# Load the model and processor
|
| 5 |
print("Loading model...")
|
| 6 |
processor = AutoImageProcessor.from_pretrained("Organika/sdxl-detector")
|
| 7 |
model = AutoModelForImageClassification.from_pretrained("Organika/sdxl-detector")
|
| 8 |
-
pipe = pipeline("image-classification", model="Organika/sdxl-detector")
|
| 9 |
print("Model loaded successfully!")
|
| 10 |
|
| 11 |
def detect_ai(image):
|
|
@@ -22,10 +21,7 @@ def detect_ai(image):
|
|
| 22 |
return {}
|
| 23 |
|
| 24 |
try:
|
| 25 |
-
#
|
| 26 |
-
pipe_out = pipe(image)
|
| 27 |
-
|
| 28 |
-
# Direct model inference for more detailed results
|
| 29 |
inputs = processor(images=image, return_tensors="pt")
|
| 30 |
outputs = model(**inputs)
|
| 31 |
logits = outputs.logits
|
|
@@ -51,7 +47,7 @@ demo = gr.Interface(
|
|
| 51 |
outputs=gr.Label(num_top_classes=2, label="AI vs Real Probability"),
|
| 52 |
title="🤖 AI‑Generated Image Detector",
|
| 53 |
description="""
|
| 54 |
-
Upload an image to detect whether it's AI-generated or real
|
| 55 |
|
| 56 |
This model can help identify images generated by AI systems like DALL-E, Midjourney, Stable Diffusion, and others.
|
| 57 |
|
|
@@ -62,8 +58,7 @@ demo = gr.Interface(
|
|
| 62 |
""",
|
| 63 |
article="""
|
| 64 |
### About the Model
|
| 65 |
-
|
| 66 |
-
to classify images as either AI-generated or real. The model has been trained to detect various AI-generated images
|
| 67 |
with a focus on SDXL and similar diffusion models.
|
| 68 |
|
| 69 |
### Limitations
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 3 |
|
| 4 |
# Load the model and processor
|
| 5 |
print("Loading model...")
|
| 6 |
processor = AutoImageProcessor.from_pretrained("Organika/sdxl-detector")
|
| 7 |
model = AutoModelForImageClassification.from_pretrained("Organika/sdxl-detector")
|
|
|
|
| 8 |
print("Model loaded successfully!")
|
| 9 |
|
| 10 |
def detect_ai(image):
|
|
|
|
| 21 |
return {}
|
| 22 |
|
| 23 |
try:
|
| 24 |
+
# Direct model inference
|
|
|
|
|
|
|
|
|
|
| 25 |
inputs = processor(images=image, return_tensors="pt")
|
| 26 |
outputs = model(**inputs)
|
| 27 |
logits = outputs.logits
|
|
|
|
| 47 |
outputs=gr.Label(num_top_classes=2, label="AI vs Real Probability"),
|
| 48 |
title="🤖 AI‑Generated Image Detector",
|
| 49 |
description="""
|
| 50 |
+
Upload an image to detect whether it's AI-generated or real.
|
| 51 |
|
| 52 |
This model can help identify images generated by AI systems like DALL-E, Midjourney, Stable Diffusion, and others.
|
| 53 |
|
|
|
|
| 58 |
""",
|
| 59 |
article="""
|
| 60 |
### About the Model
|
| 61 |
+
The model has been trained to detect various AI-generated images
|
|
|
|
| 62 |
with a focus on SDXL and similar diffusion models.
|
| 63 |
|
| 64 |
### Limitations
|