djamker commited on
Commit
6e04b38
·
verified ·
1 Parent(s): 28329d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- clf = pipeline("text-classification", model="MayZhou/e5-small-lora-ai-generated-detector")
 
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
- # Launch the app with a basic Gradio Interface (exposes /predict endpoint)
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()