Fix: remove show_copy_button parameter
Browse files
app.py
CHANGED
|
@@ -7,11 +7,11 @@ from collections import Counter
|
|
| 7 |
|
| 8 |
nltk.download('punkt', quiet=True)
|
| 9 |
|
| 10 |
-
# Load your exact models
|
| 11 |
model = pickle.load(open('sentence_model.pkl', 'rb'))
|
| 12 |
vectorizer = pickle.load(open('vectorizer.pkl', 'rb'))
|
| 13 |
|
| 14 |
-
# ============ YOUR EXACT FUNCTIONS
|
| 15 |
|
| 16 |
def detect_content_type(text):
|
| 17 |
"""Manually detect content type based on keywords"""
|
|
@@ -156,7 +156,7 @@ def predict_paragraph(paragraph):
|
|
| 156 |
'sentence_results': results
|
| 157 |
}
|
| 158 |
|
| 159 |
-
# ============ GRADIO FUNCTION ============
|
| 160 |
def analyze_text(text):
|
| 161 |
if len(text.strip()) < 10:
|
| 162 |
return "❌ Please enter at least 10 characters"
|
|
@@ -203,7 +203,7 @@ def analyze_text(text):
|
|
| 203 |
|
| 204 |
return output
|
| 205 |
|
| 206 |
-
# ============ GRADIO INTERFACE ============
|
| 207 |
demo = gr.Interface(
|
| 208 |
fn=analyze_text,
|
| 209 |
inputs=gr.Textbox(
|
|
@@ -213,8 +213,8 @@ demo = gr.Interface(
|
|
| 213 |
),
|
| 214 |
outputs=gr.Textbox(
|
| 215 |
lines=25,
|
| 216 |
-
label="🔍 Analysis Result"
|
| 217 |
-
show_copy_button=True
|
| 218 |
),
|
| 219 |
title="🤖 AI vs Human Text Detector",
|
| 220 |
description="Detect whether text is written by AI or Human with 90.5% accuracy. Also detects code, content type, and provides sentence-level analysis.",
|
|
|
|
| 7 |
|
| 8 |
nltk.download('punkt', quiet=True)
|
| 9 |
|
| 10 |
+
# Load your exact models
|
| 11 |
model = pickle.load(open('sentence_model.pkl', 'rb'))
|
| 12 |
vectorizer = pickle.load(open('vectorizer.pkl', 'rb'))
|
| 13 |
|
| 14 |
+
# ============ YOUR EXACT FUNCTIONS ============
|
| 15 |
|
| 16 |
def detect_content_type(text):
|
| 17 |
"""Manually detect content type based on keywords"""
|
|
|
|
| 156 |
'sentence_results': results
|
| 157 |
}
|
| 158 |
|
| 159 |
+
# ============ GRADIO FUNCTION (FIXED - removed show_copy_button) ============
|
| 160 |
def analyze_text(text):
|
| 161 |
if len(text.strip()) < 10:
|
| 162 |
return "❌ Please enter at least 10 characters"
|
|
|
|
| 203 |
|
| 204 |
return output
|
| 205 |
|
| 206 |
+
# ============ GRADIO INTERFACE (FIXED) ============
|
| 207 |
demo = gr.Interface(
|
| 208 |
fn=analyze_text,
|
| 209 |
inputs=gr.Textbox(
|
|
|
|
| 213 |
),
|
| 214 |
outputs=gr.Textbox(
|
| 215 |
lines=25,
|
| 216 |
+
label="🔍 Analysis Result"
|
| 217 |
+
# Removed show_copy_button=True - not supported in this Gradio version
|
| 218 |
),
|
| 219 |
title="🤖 AI vs Human Text Detector",
|
| 220 |
description="Detect whether text is written by AI or Human with 90.5% accuracy. Also detects code, content type, and provides sentence-level analysis.",
|