Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -272,19 +272,22 @@ def paraphrase_and_correct(text):
|
|
| 272 |
def detect_ai(text):
|
| 273 |
label, score = predict_en(text)
|
| 274 |
return label, score
|
| 275 |
-
|
| 276 |
-
# Gradio interface setup
|
| 277 |
def gradio_interface(text):
|
| 278 |
-
|
| 279 |
corrected_text = paraphrase_and_correct(text)
|
| 280 |
-
return
|
| 281 |
-
|
| 282 |
-
#
|
| 283 |
-
iface = gr.Interface(
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
| 289 |
# Launch the app
|
| 290 |
iface.launch()
|
|
|
|
| 272 |
def detect_ai(text):
|
| 273 |
label, score = predict_en(text)
|
| 274 |
return label, score
|
|
|
|
|
|
|
| 275 |
def gradio_interface(text):
|
| 276 |
+
label, score = detect_ai(text)
|
| 277 |
corrected_text = paraphrase_and_correct(text)
|
| 278 |
+
return {label: score}, corrected_text
|
| 279 |
+
|
| 280 |
+
# Modify the Gradio interface setup
|
| 281 |
+
iface = gr.Interface(
|
| 282 |
+
fn=gradio_interface,
|
| 283 |
+
inputs=gr.Textbox(lines=5, placeholder="Enter text here..."),
|
| 284 |
+
outputs=[
|
| 285 |
+
gr.Label(num_top_classes=1),
|
| 286 |
+
gr.Textbox(label="Corrected Text")
|
| 287 |
+
],
|
| 288 |
+
title="AI Detection and Grammar Correction",
|
| 289 |
+
description="Detect AI-generated content and correct grammar issues."
|
| 290 |
+
)
|
| 291 |
|
| 292 |
# Launch the app
|
| 293 |
iface.launch()
|