Spaces:
Running
Running
Commit
·
55e862e
1
Parent(s):
b303ff0
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,12 +12,10 @@ synthesiser = pipeline("text-to-speech", "suno/bark")
|
|
| 12 |
|
| 13 |
# Function to extract abstract from PDF
|
| 14 |
def extract_abstract(pdf_content):
|
| 15 |
-
# Convert
|
| 16 |
-
pdf_bytes = pdf_content
|
| 17 |
-
|
| 18 |
-
# Open the PDF with PyMuPDF
|
| 19 |
-
doc = fitz.open(stream=pdf_bytes, filetype="pdf")
|
| 20 |
|
|
|
|
| 21 |
first_page = doc[0].get_text()
|
| 22 |
start_idx = first_page.lower().find("abstract")
|
| 23 |
end_idx = first_page.lower().find("introduction")
|
|
|
|
| 12 |
|
| 13 |
# Function to extract abstract from PDF
|
| 14 |
def extract_abstract(pdf_content):
|
| 15 |
+
# Convert NamedString object to bytes
|
| 16 |
+
pdf_bytes = pdf_content["content"]
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
doc = fitz.open(stream=pdf_bytes, filetype="pdf")
|
| 19 |
first_page = doc[0].get_text()
|
| 20 |
start_idx = first_page.lower().find("abstract")
|
| 21 |
end_idx = first_page.lower().find("introduction")
|