Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
# Load the model | |
clf = pipeline("text-classification", model="MayZhou/e5-small-lora-ai-generated-detector") | |
# Define detection function | |
def detect_ai(text): | |
result = clf(text)[0] | |
label = result['label'] | |
score = round(result['score'] * 100, 2) | |
return f"{label} ({score}%)" | |
# Build the interface | |
demo = gr.Interface( | |
fn=detect_ai, | |
inputs="textbox", | |
outputs="text", | |
title="AI Text Detector" | |
) | |
# Launch the app | |
demo.launch() | |