Spaces:
Running
on
Zero
Running
on
Zero
app.py
CHANGED
@@ -145,12 +145,12 @@ def create_messages(review_fields, paper_text):
|
|
145 |
]
|
146 |
return messages
|
147 |
|
148 |
-
@spaces.GPU(
|
149 |
def convert_file(filepath):
|
150 |
full_text, images, out_metadata = convert_single_pdf(
|
151 |
filepath, model_refs, metadata=metadata, max_pages=MAX_PAGES
|
152 |
)
|
153 |
-
return full_text
|
154 |
|
155 |
def process_file(file):
|
156 |
print(file.name)
|
@@ -165,6 +165,7 @@ def process_file(file):
|
|
165 |
if length < MIN_LENGTH:
|
166 |
raise ValueError()
|
167 |
paper_text = convert_file(filepath)
|
|
|
168 |
if not len(paper_text) > MIN_LENGTH:
|
169 |
raise ValueError()
|
170 |
except spaces.zero.gradio.HTMLError as e:
|
|
|
145 |
]
|
146 |
return messages
|
147 |
|
148 |
+
@spaces.GPU()
|
149 |
def convert_file(filepath):
|
150 |
full_text, images, out_metadata = convert_single_pdf(
|
151 |
filepath, model_refs, metadata=metadata, max_pages=MAX_PAGES
|
152 |
)
|
153 |
+
return full_text
|
154 |
|
155 |
def process_file(file):
|
156 |
print(file.name)
|
|
|
165 |
if length < MIN_LENGTH:
|
166 |
raise ValueError()
|
167 |
paper_text = convert_file(filepath)
|
168 |
+
paper_text = paper_text.strip()
|
169 |
if not len(paper_text) > MIN_LENGTH:
|
170 |
raise ValueError()
|
171 |
except spaces.zero.gradio.HTMLError as e:
|