Update app.py
Browse files
app.py
CHANGED
@@ -16,15 +16,13 @@ import random
|
|
16 |
nltk.download('punkt')
|
17 |
nltk.download('stopwords')
|
18 |
nltk.download('averaged_perceptron_tagger')
|
19 |
-
nltk.download('averaged_perceptron_tagger_eng')
|
20 |
nltk.download('wordnet')
|
21 |
nltk.download('omw-1.4')
|
22 |
-
nltk.download('punkt_tab')
|
23 |
|
24 |
# Initialize stopwords
|
25 |
stop_words = set(stopwords.words("english"))
|
26 |
|
27 |
-
#
|
28 |
exclude_tags = {'PRP', 'PRP$', 'MD', 'VBZ', 'VBP', 'VBD', 'VBG', 'VBN', 'TO', 'IN', 'DT', 'CC'}
|
29 |
exclude_words = {'is', 'am', 'are', 'was', 'were', 'have', 'has', 'do', 'does', 'did', 'will', 'shall', 'should', 'would', 'could', 'can', 'may', 'might'}
|
30 |
|
@@ -34,7 +32,7 @@ pipeline_en = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt
|
|
34 |
# Initialize the spell checker
|
35 |
spell = SpellChecker()
|
36 |
|
37 |
-
#
|
38 |
try:
|
39 |
nlp = spacy.load("en_core_web_sm")
|
40 |
except OSError:
|
@@ -213,20 +211,19 @@ def paraphrase_and_correct(text):
|
|
213 |
|
214 |
# Gradio app setup
|
215 |
with gr.Blocks() as demo:
|
216 |
-
with gr.Tab("
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
score1 = gr.Textbox(lines=1, label='Prob')
|
221 |
|
222 |
-
|
223 |
|
224 |
-
with gr.Tab("
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
|
229 |
-
|
230 |
|
231 |
# Launch the Gradio app
|
232 |
demo.launch()
|
|
|
16 |
nltk.download('punkt')
|
17 |
nltk.download('stopwords')
|
18 |
nltk.download('averaged_perceptron_tagger')
|
|
|
19 |
nltk.download('wordnet')
|
20 |
nltk.download('omw-1.4')
|
|
|
21 |
|
22 |
# Initialize stopwords
|
23 |
stop_words = set(stopwords.words("english"))
|
24 |
|
25 |
+
# Exclusion lists
|
26 |
exclude_tags = {'PRP', 'PRP$', 'MD', 'VBZ', 'VBP', 'VBD', 'VBG', 'VBN', 'TO', 'IN', 'DT', 'CC'}
|
27 |
exclude_words = {'is', 'am', 'are', 'was', 'were', 'have', 'has', 'do', 'does', 'did', 'will', 'shall', 'should', 'would', 'could', 'can', 'may', 'might'}
|
28 |
|
|
|
32 |
# Initialize the spell checker
|
33 |
spell = SpellChecker()
|
34 |
|
35 |
+
# Load the SpaCy model
|
36 |
try:
|
37 |
nlp = spacy.load("en_core_web_sm")
|
38 |
except OSError:
|
|
|
211 |
|
212 |
# Gradio app setup
|
213 |
with gr.Blocks() as demo:
|
214 |
+
with gr.Tab("Text Input"):
|
215 |
+
text_input = gr.TextArea(label="Input Text", placeholder="Enter text here...")
|
216 |
+
text_output = gr.TextArea(label="Output Text", interactive=False)
|
217 |
+
submit_btn = gr.Button("Submit")
|
|
|
218 |
|
219 |
+
submit_btn.click(paraphrase_and_correct, inputs=text_input, outputs=text_output)
|
220 |
|
221 |
+
with gr.Tab("AI Detection"):
|
222 |
+
ai_input = gr.TextArea(label="Input Text for AI Detection", placeholder="Enter text here...")
|
223 |
+
ai_output = gr.Textbox(label="AI Detection Result", interactive=False)
|
224 |
+
ai_submit_btn = gr.Button("Submit for AI Detection")
|
225 |
|
226 |
+
ai_submit_btn.click(predict_en, inputs=ai_input, outputs=ai_output)
|
227 |
|
228 |
# Launch the Gradio app
|
229 |
demo.launch()
|