sashtech commited on
Commit
a2b6ad0
·
verified ·
1 Parent(s): cce92ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
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
- ai_result = detect_ai(text)
279
  corrected_text = paraphrase_and_correct(text)
280
- return ai_result, corrected_text
281
-
282
- # Create Gradio interface
283
- iface = gr.Interface(fn=gradio_interface,
284
- inputs=gr.Textbox(lines=5, placeholder="Enter text here..."),
285
- outputs=[gr.Label(num_top_classes=2), gr.Textbox()],
286
- title="AI Detection and Grammar Correction",
287
- description="Detect AI-generated content and correct grammar issues.")
 
 
 
 
 
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()