Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,41 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
def
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from ai_text_detector_valid_final import detect_text
|
| 3 |
+
|
| 4 |
+
def analyze_text(user_text):
|
| 5 |
+
return detect_text(user_text)
|
| 6 |
+
|
| 7 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 8 |
+
gr.Markdown(
|
| 9 |
+
"""
|
| 10 |
+
# 🔍 AI vs Human Text Detector
|
| 11 |
+
Paste any text below and our system will analyze it using **3 different models**
|
| 12 |
+
and generate a final average probability.
|
| 13 |
+
"""
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
with gr.Row():
|
| 17 |
+
with gr.Column(scale=2):
|
| 18 |
+
user_input = gr.Textbox(
|
| 19 |
+
label="✍️ Enter Text",
|
| 20 |
+
placeholder="Paste text here...",
|
| 21 |
+
lines=10
|
| 22 |
+
)
|
| 23 |
+
analyze_btn = gr.Button("🚀 Run Detection", variant="primary")
|
| 24 |
+
|
| 25 |
+
with gr.Column(scale=1):
|
| 26 |
+
final_output = gr.JSON(label="📊 Final Results")
|
| 27 |
+
|
| 28 |
+
with gr.Accordion("🔬 Detailed Model Results", open=False):
|
| 29 |
+
model_output = gr.JSON(label="All Model Scores")
|
| 30 |
+
|
| 31 |
+
def run_analysis(user_text):
|
| 32 |
+
results = analyze_text(user_text)
|
| 33 |
+
return results, results # send to both JSON outputs
|
| 34 |
+
|
| 35 |
+
analyze_btn.click(
|
| 36 |
+
fn=run_analysis,
|
| 37 |
+
inputs=user_input,
|
| 38 |
+
outputs=[final_output, model_output]
|
| 39 |
+
)
|
| 40 |
|
| 41 |
demo.launch()
|