VictorM-Coder commited on
Commit
1c57659
·
verified ·
1 Parent(s): 2bb6fdc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -6,9 +6,9 @@ import pandas as pd
6
  import gradio as gr
7
 
8
  # ----------------------------------------------------
9
- # LOAD CAUSAL LM (GPT-J 6B = Best balance)
10
  # ----------------------------------------------------
11
- MODEL_NAME = "EleutherAI/gpt-j-6B"
12
 
13
  tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
14
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -70,7 +70,6 @@ def detectgpt_score(sentence, perturbations=5):
70
  if not pert_scores:
71
  return 0
72
 
73
- # DetectGPT signal
74
  return np.mean(pert_scores) - base
75
 
76
 
@@ -98,7 +97,6 @@ def classify_text(text):
98
  else:
99
  highlighted.append(f"<p style='color:green;font-weight:bold'>{s}</p>")
100
 
101
- # Document-level score rescaled 0–100%
102
  avg = np.mean(scores)
103
  doc_ai = max(0, min(100, (avg + 1) * 50))
104
 
@@ -112,7 +110,7 @@ def classify_text(text):
112
  # GRADIO UI
113
  # ----------------------------------------------------
114
  with gr.Blocks() as demo:
115
- gr.Markdown("## 🧠 Writenix DetectGPT (GPT-J-6B Version)")
116
 
117
  text_input = gr.Textbox(
118
  label="Enter text",
 
6
  import gradio as gr
7
 
8
  # ----------------------------------------------------
9
+ # LOAD CAUSAL LM (Memory-safe model)
10
  # ----------------------------------------------------
11
+ MODEL_NAME = "EleutherAI/gpt-neo-2.7B"
12
 
13
  tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
14
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
70
  if not pert_scores:
71
  return 0
72
 
 
73
  return np.mean(pert_scores) - base
74
 
75
 
 
97
  else:
98
  highlighted.append(f"<p style='color:green;font-weight:bold'>{s}</p>")
99
 
 
100
  avg = np.mean(scores)
101
  doc_ai = max(0, min(100, (avg + 1) * 50))
102
 
 
110
  # GRADIO UI
111
  # ----------------------------------------------------
112
  with gr.Blocks() as demo:
113
+ gr.Markdown("## 🧠 Writenix DetectGPT (GPT-Neo 2.7B Version)")
114
 
115
  text_input = gr.Textbox(
116
  label="Enter text",