import gradio as gr | |
from transformers import pipeline | |
clf = pipeline("text-classification", model="Desklib/ai-text-detector-v1.01") | |
def detect(text): | |
if not text.strip(): | |
return "No input" | |
result = clf(text)[0] | |
label = result['label'] | |
score = round(result['score'] * 100, 2) | |
return f"{label} ({score}%)" | |
gr.Interface(fn=detect, inputs="text", outputs="text", title="AI Detector Test").launch() | |