Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,15 +31,12 @@ def extract_abstract_and_summarize(pdf_file):
|
|
| 31 |
abstract_text = text[start_index:end_index]
|
| 32 |
break
|
| 33 |
|
| 34 |
-
# Summarize the extracted abstract using the LED-large model
|
| 35 |
-
result = summarizer(abstract_text)
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
print("Result:", result)
|
| 39 |
-
|
| 40 |
-
# Check if 'summary' is present in the result
|
| 41 |
if result and isinstance(result, list) and len(result) > 0:
|
| 42 |
-
summary = result[0].get('
|
| 43 |
else:
|
| 44 |
summary = "Summary not available."
|
| 45 |
|
|
|
|
| 31 |
abstract_text = text[start_index:end_index]
|
| 32 |
break
|
| 33 |
|
| 34 |
+
# Summarize the extracted abstract using the LED-large model with a specific max_length
|
| 35 |
+
result = summarizer(abstract_text, max_length=81)
|
| 36 |
|
| 37 |
+
# Check if 'summary_text' is present in the result
|
|
|
|
|
|
|
|
|
|
| 38 |
if result and isinstance(result, list) and len(result) > 0:
|
| 39 |
+
summary = result[0].get('summary_text', 'Summary not available.')
|
| 40 |
else:
|
| 41 |
summary = "Summary not available."
|
| 42 |
|