modeltest / app.py
djamker's picture
Create app.py
d133ad9 verified
raw
history blame contribute delete
425 Bytes
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()