Spaces:
Sleeping
Sleeping
File size: 511 Bytes
5e2b57d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|