Spaces:
Sleeping
Sleeping
aliasgerovs
commited on
Commit
·
4ffd446
1
Parent(s):
af4e1a5
Added PDF upload UI.
Browse files- __pycache__/utils.cpython-311.pyc +0 -0
- __pycache__/writing_analysis.cpython-311.pyc +0 -0
- app.py +14 -3
- requirements.txt +2 -1
__pycache__/utils.cpython-311.pyc
DELETED
Binary file (12.9 kB)
|
|
__pycache__/writing_analysis.cpython-311.pyc
DELETED
Binary file (7.76 kB)
|
|
app.py
CHANGED
@@ -13,7 +13,7 @@ from scipy.special import softmax
|
|
13 |
from evaluate import load
|
14 |
from datetime import date
|
15 |
import nltk
|
16 |
-
|
17 |
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
|
18 |
import nltk, spacy, subprocess, torch
|
19 |
import plotly.graph_objects as go
|
@@ -264,6 +264,14 @@ def len_validator(text):
|
|
264 |
else :
|
265 |
return f"Input length satisified."
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
# DEPTH ANALYSIS
|
268 |
print("loading depth analysis")
|
269 |
nltk.download('stopwords')
|
@@ -378,11 +386,14 @@ with gr.Blocks() as demo:
|
|
378 |
# Copyright Checker
|
379 |
"""
|
380 |
)
|
381 |
-
|
|
|
|
|
|
|
|
|
382 |
char_count = gr.Textbox(label="Minumum Character Limit Check")
|
383 |
input_text.change(fn=len_validator, inputs=input_text, outputs=char_count)
|
384 |
|
385 |
-
|
386 |
with gr.Row():
|
387 |
with gr.Column():
|
388 |
only_ai_btn = gr.Button("AI Check")
|
|
|
13 |
from evaluate import load
|
14 |
from datetime import date
|
15 |
import nltk
|
16 |
+
import fitz
|
17 |
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
|
18 |
import nltk, spacy, subprocess, torch
|
19 |
import plotly.graph_objects as go
|
|
|
264 |
else :
|
265 |
return f"Input length satisified."
|
266 |
|
267 |
+
def extract_text_from_pdf(pdf_path):
|
268 |
+
doc = fitz.open(pdf_path)
|
269 |
+
text = ""
|
270 |
+
for page in doc:
|
271 |
+
text += page.get_text()
|
272 |
+
return text
|
273 |
+
|
274 |
+
|
275 |
# DEPTH ANALYSIS
|
276 |
print("loading depth analysis")
|
277 |
nltk.download('stopwords')
|
|
|
386 |
# Copyright Checker
|
387 |
"""
|
388 |
)
|
389 |
+
with gr.Row():
|
390 |
+
input_text = gr.Textbox(label="Input text", lines=6, placeholder="")
|
391 |
+
file_input = gr.File(label="Upload PDF")
|
392 |
+
file_input.change(fn=extract_text_from_pdf, inputs=file_input, outputs=input_text)
|
393 |
+
|
394 |
char_count = gr.Textbox(label="Minumum Character Limit Check")
|
395 |
input_text.change(fn=len_validator, inputs=input_text, outputs=char_count)
|
396 |
|
|
|
397 |
with gr.Row():
|
398 |
with gr.Column():
|
399 |
only_ai_btn = gr.Button("AI Check")
|
requirements.txt
CHANGED
@@ -19,4 +19,5 @@ keras
|
|
19 |
spacy
|
20 |
textstat
|
21 |
plotly
|
22 |
-
tqdm
|
|
|
|
19 |
spacy
|
20 |
textstat
|
21 |
plotly
|
22 |
+
tqdm
|
23 |
+
pymupdf
|