import gradio as gr from transformers import pipeline # Load model model = pipeline("image-classification", model="Ateeqq/ai-vs-human-image-detector") # Function for checking AI image def check_image(image): results = model(image) label = results[0]['label'] score = results[0]['score'] return f"Prediction: {label.capitalize()} (Confidence: {score*100:.2f}%)" # Gradio interface - EVERYTHING stays inside this Interface(...) iface = gr.Interface( fn=check_image, inputs=gr.Image(type="pil"), outputs=gr.Textbox(), title="Reality - AI Image Detector", description="Upload an image to check if it is AI-generated or real." ) # Launch UI iface.launch()