ShiwenNi commited on
Commit
3b21f9e
·
verified ·
1 Parent(s): fc55717

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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, gradio.utils NamedString):
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)