Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
import transformers
|
| 4 |
import spaces
|
| 5 |
-
from synthid_text import logits_processing
|
| 6 |
from synthid_text.detector_mean import mean_score
|
| 7 |
|
| 8 |
# Configurations and model selection
|
|
@@ -83,23 +83,47 @@ def check_plagiarism(text):
|
|
| 83 |
# Define the Gradio interface
|
| 84 |
def create_plagiarism_checker():
|
| 85 |
with gr.Blocks() as app:
|
| 86 |
-
|
| 87 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
# Output box to display the result with highlighted watermark
|
| 93 |
-
output = gr.HTML(label="Integrity Check Result")
|
| 94 |
-
|
| 95 |
-
# Button to initiate the check
|
| 96 |
-
check_button = gr.Button("Check Text")
|
| 97 |
|
| 98 |
# Define the click event for the button
|
| 99 |
check_button.click(fn=check_plagiarism, inputs=text_input, outputs=output)
|
| 100 |
|
| 101 |
return app
|
| 102 |
|
| 103 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
plagiarism_checker_app = create_plagiarism_checker()
|
| 105 |
-
plagiarism_checker_app.launch()
|
|
|
|
| 2 |
import torch
|
| 3 |
import transformers
|
| 4 |
import spaces
|
| 5 |
+
from synthid_text import synthid_mixin,logits_processing
|
| 6 |
from synthid_text.detector_mean import mean_score
|
| 7 |
|
| 8 |
# Configurations and model selection
|
|
|
|
| 83 |
# Define the Gradio interface
|
| 84 |
def create_plagiarism_checker():
|
| 85 |
with gr.Blocks() as app:
|
| 86 |
+
# Title and description with formatting
|
| 87 |
+
gr.Markdown("""
|
| 88 |
+
# 📝 Plagiarism and Academic Integrity Checker
|
| 89 |
+
Use this tool to detect AI-generated content in your text using SynthID technology.
|
| 90 |
+
Paste your text below to check if it contains AI-generated segments.
|
| 91 |
+
---
|
| 92 |
+
""")
|
| 93 |
|
| 94 |
+
# Layout the components in a single row
|
| 95 |
+
with gr.Row():
|
| 96 |
+
# Input textbox for users to paste text
|
| 97 |
+
text_input = gr.Textbox(
|
| 98 |
+
placeholder="Paste your text here...",
|
| 99 |
+
label="Input Text",
|
| 100 |
+
lines=10,
|
| 101 |
+
max_lines=20,
|
| 102 |
+
elem_id="text_input",
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
# Divider for clarity
|
| 106 |
+
gr.Markdown("---")
|
| 107 |
|
| 108 |
# Output box to display the result with highlighted watermark
|
| 109 |
+
output = gr.HTML(label="Integrity Check Result", elem_id="output")
|
| 110 |
+
|
| 111 |
+
# Button to initiate the check, styled with a color accent
|
| 112 |
+
check_button = gr.Button("🔍 Check Text", elem_id="check_button")
|
| 113 |
|
| 114 |
# Define the click event for the button
|
| 115 |
check_button.click(fn=check_plagiarism, inputs=text_input, outputs=output)
|
| 116 |
|
| 117 |
return app
|
| 118 |
|
| 119 |
+
# Add some basic CSS for styling
|
| 120 |
+
css = """
|
| 121 |
+
#text_input { font-size: 16px; border: 1px solid #ddd; padding: 8px; }
|
| 122 |
+
#output { font-size: 16px; padding: 8px; border-radius: 5px; }
|
| 123 |
+
#check_button { font-size: 16px; background-color: #4CAF50; color: white; border: none; padding: 10px 20px; cursor: pointer; }
|
| 124 |
+
#check_button:hover { background-color: #45a049; }
|
| 125 |
+
"""
|
| 126 |
+
|
| 127 |
+
# Launch the app with the custom CSS
|
| 128 |
plagiarism_checker_app = create_plagiarism_checker()
|
| 129 |
+
plagiarism_checker_app.launch(css=css)
|