Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,11 @@ from nltk.corpus import wordnet
|
|
| 9 |
# Initialize the English text classification pipeline for AI detection
|
| 10 |
pipeline_en = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Ensure necessary NLTK data is downloaded for Humanifier
|
| 13 |
nltk.download('wordnet')
|
| 14 |
nltk.download('omw-1.4')
|
|
|
|
| 9 |
# Initialize the English text classification pipeline for AI detection
|
| 10 |
pipeline_en = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta")
|
| 11 |
|
| 12 |
+
# Function to predict the label and score for English text (AI Detection)
|
| 13 |
+
def predict_en(text):
|
| 14 |
+
res = pipeline_en(text)[0]
|
| 15 |
+
return res['label'], res['score']
|
| 16 |
+
|
| 17 |
# Ensure necessary NLTK data is downloaded for Humanifier
|
| 18 |
nltk.download('wordnet')
|
| 19 |
nltk.download('omw-1.4')
|