amendolajine commited on
Commit
7e93398
·
1 Parent(s): 0666275

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -28,13 +28,16 @@ def 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)
 
28
  return "Error in abstract extraction"
29
 
30
  def process_text(uploaded_file):
31
+ # Debugging: Print the type and contents of the uploaded_file
32
+ print(f"Uploaded file type: {type(uploaded_file)}")
33
+ print(f"Uploaded file content: {uploaded_file}")
34
+
35
+ # Check if uploaded_file is a dictionary with 'data' key
36
+ if isinstance(uploaded_file, dict) and 'data' in uploaded_file:
37
+ pdf_bytes = uploaded_file['data']
38
+ else:
39
+ print("Uploaded file is not in the expected format")
40
+ return "File content could not be retrieved", None
41
 
42
  try:
43
  abstract_text = extract_abstract(pdf_bytes)