Spaces:
Running
Running
Commit
·
7e5f9d1
1
Parent(s):
1842832
Update app.py
Browse files
app.py
CHANGED
@@ -28,16 +28,17 @@ def extract_abstract(pdf_bytes):
|
|
28 |
return "Error in abstract extraction"
|
29 |
|
30 |
def process_text(uploaded_file):
|
31 |
-
# Debugging: Print the type and
|
32 |
print(f"Uploaded file type: {type(uploaded_file)}")
|
33 |
-
print(f"Uploaded file
|
34 |
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
try:
|
43 |
abstract_text = extract_abstract(pdf_bytes)
|
|
|
28 |
return "Error in abstract extraction"
|
29 |
|
30 |
def process_text(uploaded_file):
|
31 |
+
# Debugging: Print the type and path of the uploaded_file
|
32 |
print(f"Uploaded file type: {type(uploaded_file)}")
|
33 |
+
print(f"Uploaded file path: {uploaded_file}")
|
34 |
|
35 |
+
# Read PDF file from the path
|
36 |
+
try:
|
37 |
+
with open(uploaded_file, "rb") as file:
|
38 |
+
pdf_bytes = file.read()
|
39 |
+
except Exception as e:
|
40 |
+
print(f"Error reading file from path: {e}")
|
41 |
+
return "Error reading PDF file", None
|
42 |
|
43 |
try:
|
44 |
abstract_text = extract_abstract(pdf_bytes)
|