yagnik12 commited on
Commit
048a065
·
verified ·
1 Parent(s): f124c80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -2,14 +2,15 @@ import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
3
  from datasets import load_dataset
4
 
5
- # Load your fine-tuned model from HF Hub
6
- MODEL = "yagnik12/AI_Text_Detecter_HanxiGuo_BiScope-Data" # ✅ use fine-tuned model
 
7
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
8
  model = AutoModelForSequenceClassification.from_pretrained(MODEL)
9
 
10
  detector = pipeline("text-classification", model=model, tokenizer=tokenizer, return_all_scores=True)
11
 
12
- # Load BiScope dataset (for demo examples)
13
  biscope = load_dataset("HanxiGuo/BiScope_Data", split="test[:20]")
14
 
15
  def detect_ai(text):
@@ -24,8 +25,8 @@ def detect_ai(text):
24
  }
25
 
26
  with gr.Blocks() as demo:
27
- gr.Markdown("# AI vs Human Text Detector (BiScope)")
28
-
29
  with gr.Row():
30
  inp = gr.Textbox(lines=5, placeholder="Enter text here...")
31
  out = gr.JSON()
 
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
3
  from datasets import load_dataset
4
 
5
+ # Use your fine-tuned model (after running train.py)
6
+ MODEL = "yagnik12/biscope-detector"
7
+
8
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
9
  model = AutoModelForSequenceClassification.from_pretrained(MODEL)
10
 
11
  detector = pipeline("text-classification", model=model, tokenizer=tokenizer, return_all_scores=True)
12
 
13
+ # Load some BiScope test examples for demo
14
  biscope = load_dataset("HanxiGuo/BiScope_Data", split="test[:20]")
15
 
16
  def detect_ai(text):
 
25
  }
26
 
27
  with gr.Blocks() as demo:
28
+ gr.Markdown("# AI vs Human Text Detector (BiScope Dataset)")
29
+
30
  with gr.Row():
31
  inp = gr.Textbox(lines=5, placeholder="Enter text here...")
32
  out = gr.JSON()