Spaces:
Sleeping
Sleeping
File size: 724 Bytes
818f08a 8c62a11 1f734ae 8c62a11 87c6792 fc6706b 8c62a11 87c6792 bec0ab9 fc6706b 8c62a11 c079b6e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import gradio as gr
from transformers import pipeline
model = pipeline("image-classification", model="Ateeqq/ai-vs-human-image-detector")
def check_image(image):
results = model(image)
label = results[0]["label"]
confidence = round(results[0]["score"] * 100, 2)
return {"prediction": label, "confidence": confidence}
with gr.Blocks() as demo:
gr.Markdown("# Reality - AI Image Detector")
image_input = gr.Image(type="pil", label="Upload Image")
output_json = gr.JSON(label="Result")
btn = gr.Button("Check Image")
btn.click(fn=check_image, inputs=image_input, outputs=output_json, api_name="predict")
demo.launch(server_name="0.0.0.0", server_port=7860, share=True , show_api=True)
|