Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -109,6 +109,8 @@ class Reviewer:
|
|
109 |
|
110 |
|
111 |
def extract_chapter(self, pdf_path):
|
|
|
|
|
112 |
file_object = BytesIO(pdf_path)
|
113 |
pdf_reader = PyPDF2.PdfReader(file_object)
|
114 |
# 获取PDF的总页数
|
|
|
109 |
|
110 |
|
111 |
def extract_chapter(self, pdf_path):
|
112 |
+
if isinstance(pdf_path, gr.utils NamedString):
|
113 |
+
pdf_path = BytesIO(pdf_path.name) # 将NamedString对象转换为BytesIO对象
|
114 |
file_object = BytesIO(pdf_path)
|
115 |
pdf_reader = PyPDF2.PdfReader(file_object)
|
116 |
# 获取PDF的总页数
|