Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import torch
|
|
| 4 |
import gradio as gr
|
| 5 |
import os
|
| 6 |
import re
|
| 7 |
-
import PyPDF2
|
| 8 |
import pdfplumber
|
| 9 |
|
| 10 |
app = Flask(__name__)
|
|
@@ -67,30 +66,7 @@ def findRealProb(text):
|
|
| 67 |
|
| 68 |
def upload_file(file):
|
| 69 |
|
| 70 |
-
# if 'pdfFile' in request.files:
|
| 71 |
-
# pdf_file = request.files['pdfFile']
|
| 72 |
-
# text = ""
|
| 73 |
-
# with pdfplumber.open(pdf_file) as pdf:
|
| 74 |
-
# cnt = 0
|
| 75 |
-
# for page in pdf.pages:
|
| 76 |
-
# cnt+=1
|
| 77 |
-
# text+=(page.extract_text(x_tolerance = 1))
|
| 78 |
-
# print(text)
|
| 79 |
-
# if cnt>5:
|
| 80 |
-
# break
|
| 81 |
-
# text = text.replace('\n', ' ')
|
| 82 |
-
# return findRealProb(text)
|
| 83 |
-
# return jsonify({'text': text})
|
| 84 |
if file:
|
| 85 |
-
|
| 86 |
-
# with open(file.name, 'rb') as pdf_file:
|
| 87 |
-
# pdf_reader = PyPDF2.PdfReader(pdf_file)
|
| 88 |
-
# text = ''
|
| 89 |
-
# for page_num in range(len(pdf_reader.pages)):
|
| 90 |
-
# page = pdf_reader.pages[page_num]
|
| 91 |
-
# text += page.extract_text()
|
| 92 |
-
# text = text.replace('\n', ' ')
|
| 93 |
-
# return findRealProb(text)
|
| 94 |
pdf_file = file.name
|
| 95 |
print(file, pdf_file)
|
| 96 |
text = ""
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import os
|
| 6 |
import re
|
|
|
|
| 7 |
import pdfplumber
|
| 8 |
|
| 9 |
app = Flask(__name__)
|
|
|
|
| 66 |
|
| 67 |
def upload_file(file):
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
if file:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
pdf_file = file.name
|
| 71 |
print(file, pdf_file)
|
| 72 |
text = ""
|