Spaces:
Running
Running
Commit
·
8766103
1
Parent(s):
4605b3c
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ def process_text(uploaded_file):
|
|
| 42 |
|
| 43 |
try:
|
| 44 |
abstract_text = extract_abstract(pdf_bytes)
|
| 45 |
-
logging.info(f"Extracted abstract: {abstract_text[:
|
| 46 |
except Exception as e:
|
| 47 |
logging.error(f"Error in abstract extraction: {e}")
|
| 48 |
return "Error in processing PDF", None
|
|
@@ -66,18 +66,18 @@ def process_text(uploaded_file):
|
|
| 66 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 67 |
|
| 68 |
# Post-process the summary
|
| 69 |
-
words = summary.split()
|
| 70 |
-
cleaned_summary = []
|
| 71 |
-
for i, word in enumerate(words):
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
|
| 82 |
final_summary = ' '.join(cleaned_summary)
|
| 83 |
final_summary = final_summary[0].upper() + final_summary[1:]
|
|
|
|
| 42 |
|
| 43 |
try:
|
| 44 |
abstract_text = extract_abstract(pdf_bytes)
|
| 45 |
+
logging.info(f"Extracted abstract: {abstract_text[:200]}...") # Log first 200 chars of abstract
|
| 46 |
except Exception as e:
|
| 47 |
logging.error(f"Error in abstract extraction: {e}")
|
| 48 |
return "Error in processing PDF", None
|
|
|
|
| 66 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 67 |
|
| 68 |
# Post-process the summary
|
| 69 |
+
#words = summary.split()
|
| 70 |
+
#cleaned_summary = []
|
| 71 |
+
#for i, word in enumerate(words):
|
| 72 |
+
# if '-' in word and i < len(words) - 1:
|
| 73 |
+
# word = word.replace('-', '') + words[i + 1]
|
| 74 |
+
# words[i + 1] = ""
|
| 75 |
+
|
| 76 |
+
# if '.' in word and i != len(words) - 1:
|
| 77 |
+
# word = word.replace('.', '')
|
| 78 |
+
# cleaned_summary.append(word + ' and')
|
| 79 |
+
# else:
|
| 80 |
+
# cleaned_summary.append(word)
|
| 81 |
|
| 82 |
final_summary = ' '.join(cleaned_summary)
|
| 83 |
final_summary = final_summary[0].upper() + final_summary[1:]
|