amendolajine commited on
Commit
0666275
·
1 Parent(s): 3abff09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -28,12 +28,13 @@ def extract_abstract(pdf_bytes):
28
  return "Error in abstract extraction"
29
 
30
  def process_text(uploaded_file):
 
 
31
  try:
32
- pdf_bytes = uploaded_file.file.read()
33
- logging.info("PDF file read successfully")
34
- except AttributeError as e:
35
- logging.error(f"Error reading file content: {e}")
36
- return "File content could not be retrieved", None
37
 
38
  try:
39
  abstract_text = extract_abstract(pdf_bytes)
 
28
  return "Error in abstract extraction"
29
 
30
  def process_text(uploaded_file):
31
+ # Extract the file data (byte content) from the uploaded file
32
+ pdf_bytes = uploaded_file['data']
33
  try:
34
+ abstract_text = extract_abstract(pdf_bytes)
35
+ except Exception as e:
36
+ print(f"Error extracting abstract: {e}")
37
+ return "Error in abstract extraction", None
 
38
 
39
  try:
40
  abstract_text = extract_abstract(pdf_bytes)