maxidl commited on
Commit
c95a9da
·
1 Parent(s): ca2b156
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -145,7 +145,7 @@ 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
@@ -170,6 +170,10 @@ def process_file(file):
170
  except spaces.zero.gradio.HTMLError as e:
171
  print(e)
172
  return "Error. GPU quota exceeded. Please return later."
 
 
 
 
173
  except Exception as e:
174
  print(traceback.format_exc())
175
  print(f"Error converting {filepath}: {e}")
 
145
  ]
146
  return messages
147
 
148
+ @spaces.GPU(60)
149
  def convert_file(filepath):
150
  full_text, images, out_metadata = convert_single_pdf(
151
  filepath, model_refs, metadata=metadata, max_pages=MAX_PAGES
 
170
  except spaces.zero.gradio.HTMLError as e:
171
  print(e)
172
  return "Error. GPU quota exceeded. Please return later."
173
+ except gradio.exceptions.Error as e:
174
+ if 'GPU task aborted' in str(e):
175
+ print(e)
176
+ return 'GPU task aborted'
177
  except Exception as e:
178
  print(traceback.format_exc())
179
  print(f"Error converting {filepath}: {e}")