Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Load the Hugging Face model | |
model = pipeline("image-classification", model="alkatraz445/deepfake_detection") | |
# Define the prediction function | |
def classify_image(image): | |
results = model(image) | |
return {result['label']: result['score'] for result in results} | |
# Create the Gradio interface | |
interface = gr.Interface( | |
fn=classify_image, | |
inputs=gr.Image(type="pil"), # Accepts images in PIL format | |
outputs=gr.Label(num_top_classes=2), # Displays top two classifications with probabilities | |
title="Deepfake image detector", | |
description="Upload an image to determine whether it's real or deepfake.", | |
) | |
# Launch the Gradio app | |
interface.launch() | |