Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
def detect_ai(text):
|
| 7 |
if not text.strip():
|
|
@@ -14,12 +15,12 @@ def detect_ai(text):
|
|
| 14 |
except Exception as e:
|
| 15 |
return f"Error: {str(e)}"
|
| 16 |
|
| 17 |
-
#
|
| 18 |
demo = gr.Interface(
|
| 19 |
fn=detect_ai,
|
| 20 |
inputs=gr.Textbox(lines=4, label="Enter text"),
|
| 21 |
outputs="text",
|
| 22 |
-
title="AI Text Detector"
|
| 23 |
)
|
| 24 |
|
| 25 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Use a stable, supported model
|
| 5 |
+
clf = pipeline("text-classification", model="roberta-base-openai-detector")
|
| 6 |
|
| 7 |
def detect_ai(text):
|
| 8 |
if not text.strip():
|
|
|
|
| 15 |
except Exception as e:
|
| 16 |
return f"Error: {str(e)}"
|
| 17 |
|
| 18 |
+
# Simple Interface to expose API at /api/predict/
|
| 19 |
demo = gr.Interface(
|
| 20 |
fn=detect_ai,
|
| 21 |
inputs=gr.Textbox(lines=4, label="Enter text"),
|
| 22 |
outputs="text",
|
| 23 |
+
title="AI Text Detector"
|
| 24 |
)
|
| 25 |
|
| 26 |
demo.launch()
|