Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -60,25 +60,6 @@ def findRealProb(text):
|
|
60 |
realProb = ans/len(text)
|
61 |
return {"Real": realProb, "Fake": 1-realProb}, results
|
62 |
|
63 |
-
@app.route('/upload', methods=['POST'])
|
64 |
-
def upload_file():
|
65 |
-
if 'pdfFile' in request.files:
|
66 |
-
pdf_file = request.files['pdfFile']
|
67 |
-
text = ""
|
68 |
-
with pdfplumber.open(pdf_file) as pdf:
|
69 |
-
cnt = 0
|
70 |
-
for page in pdf.pages:
|
71 |
-
cnt+=1
|
72 |
-
text+=(page.extract_text(x_tolerance = 1))
|
73 |
-
print(text)
|
74 |
-
if cnt>5:
|
75 |
-
break
|
76 |
-
return findRealProb(text)
|
77 |
-
# return jsonify({'text': text})
|
78 |
-
else:
|
79 |
-
return {"error":'No PDF file found in request'}
|
80 |
-
|
81 |
-
|
82 |
demo = gr.Interface(
|
83 |
fn=findRealProb,
|
84 |
inputs=gr.Textbox(placeholder="Copy and paste here..."),
|
|
|
60 |
realProb = ans/len(text)
|
61 |
return {"Real": realProb, "Fake": 1-realProb}, results
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
demo = gr.Interface(
|
64 |
fn=findRealProb,
|
65 |
inputs=gr.Textbox(placeholder="Copy and paste here..."),
|