Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,9 +32,13 @@ model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-unca
|
|
| 32 |
|
| 33 |
# Initialize Gingerit for grammar correction
|
| 34 |
def correct_grammar_with_gingerit(text):
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# AI detection function using DistilBERT
|
| 40 |
def detect_ai_generated(text):
|
|
|
|
| 32 |
|
| 33 |
# Initialize Gingerit for grammar correction
|
| 34 |
def correct_grammar_with_gingerit(text):
|
| 35 |
+
try:
|
| 36 |
+
parser = GingerIt()
|
| 37 |
+
result = parser.parse(text)
|
| 38 |
+
return result['result']
|
| 39 |
+
except Exception as e:
|
| 40 |
+
print(f"Error in Gingerit grammar correction: {e}")
|
| 41 |
+
return text # Return the original text if Gingerit fails
|
| 42 |
|
| 43 |
# AI detection function using DistilBERT
|
| 44 |
def detect_ai_generated(text):
|