djamker commited on
Commit
d133ad9
·
verified ·
1 Parent(s): 3cc6899

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ clf = pipeline("text-classification", model="Desklib/ai-text-detector-v1.01")
5
+
6
+ def detect(text):
7
+ if not text.strip():
8
+ return "No input"
9
+ result = clf(text)[0]
10
+ label = result['label']
11
+ score = round(result['score'] * 100, 2)
12
+ return f"{label} ({score}%)"
13
+
14
+ gr.Interface(fn=detect, inputs="text", outputs="text", title="AI Detector Test").launch()