MCPcopy Create free account
hub / github.com/ScienciaLAB/document-qa / process_text

Method process_text

document_qa/ner_client_generic.py:295–311  ·  view source on GitHub ↗
(self, input, method_name="superconductors", params={}, headers={"Accept": "application/json"})

Source from the content-addressed store, hash-verified

293 return status, json.loads(res.text)
294
295 def process_text(self, input, method_name="superconductors", params={}, headers={"Accept": "application/json"}):
296
297 files = {"text": input}
298
299 the_url = self.get_url(method_name)
300 params, the_url = self.get_params_from_url(the_url)
301
302 res, status = self.post(url=the_url, files=files, data=params, headers=headers)
303
304 if status == 503:
305 time.sleep(self.config["sleep_time"])
306 return self.process_text(input, method_name, params, headers)
307 elif status != 200:
308 print("Processing failed with error " + str(status))
309 return status, None
310 else:
311 return status, json.loads(res.text)
312
313 def process_pdf(self, form_data: dict, method_name="superconductors", params={}, headers={"Accept": "application/json"}):
314

Callers 4

process_pdfMethod · 0.95
processMethod · 0.80
processMethod · 0.80
parse_materialMethod · 0.80

Calls 3

get_urlMethod · 0.95
get_params_from_urlMethod · 0.95
postMethod · 0.80

Tested by

no test coverage detected