Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import json
|
|
12 |
import tiktoken
|
13 |
import PyPDF2
|
14 |
import gradio
|
15 |
-
|
16 |
|
17 |
def contains_chinese(text):
|
18 |
for ch in text:
|
@@ -109,7 +109,7 @@ class Reviewer:
|
|
109 |
|
110 |
|
111 |
def extract_chapter(self, pdf_path):
|
112 |
-
if isinstance(pdf_path,
|
113 |
pdf_path = BytesIO(pdf_path.name) # 将NamedString对象转换为BytesIO对象
|
114 |
file_object = BytesIO(pdf_path)
|
115 |
pdf_reader = PyPDF2.PdfReader(file_object)
|
|
|
12 |
import tiktoken
|
13 |
import PyPDF2
|
14 |
import gradio
|
15 |
+
from gradio import NamedString
|
16 |
|
17 |
def contains_chinese(text):
|
18 |
for ch in text:
|
|
|
109 |
|
110 |
|
111 |
def extract_chapter(self, pdf_path):
|
112 |
+
if isinstance(pdf_path, NamedString):
|
113 |
pdf_path = BytesIO(pdf_path.name) # 将NamedString对象转换为BytesIO对象
|
114 |
file_object = BytesIO(pdf_path)
|
115 |
pdf_reader = PyPDF2.PdfReader(file_object)
|