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

Method process_texts

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

Source from the content-addressed store, hash-verified

275 return action_url
276
277 def process_texts(self, input, method_name="superconductors", params={}, headers={"Accept": "application/json"}):
278
279 files = {"texts": input}
280
281 the_url = self.get_url(method_name)
282 params, the_url = self.get_params_from_url(the_url)
283
284 res, status = self.post(url=the_url, files=files, data=params, headers=headers)
285
286 if status == 503:
287 time.sleep(self.config["sleep_time"])
288 return self.process_texts(input, method_name, params, headers)
289 elif status != 200:
290 print("Processing failed with error " + str(status))
291 return status, None
292 else:
293 return status, json.loads(res.text)
294
295 def process_text(self, input, method_name="superconductors", params={}, headers={"Accept": "application/json"}):
296

Callers 1

parse_materialsMethod · 0.80

Calls 3

get_urlMethod · 0.95
get_params_from_urlMethod · 0.95
postMethod · 0.80

Tested by

no test coverage detected