MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / document_question_answering

Function document_question_answering

bmtools/tools/hugging_tools/api.py:186–190  ·  view source on GitHub ↗
(model_id: str, image_file_name: str, text: str)

Source from the content-addressed store, hash-verified

184 return str(inference({"question": text, "image": img_base64}))
185 @task
186 def document_question_answering(model_id: str, image_file_name: str, text: str) -> str:
187 inference = InferenceApi(repo_id=model_id, token=CONFIG["huggingface"]["token"])
188 img_data = image_to_bytes(f"{DIRPATH}/{INPUT_PATH}/{image_file_name}")
189 img_base64 = base64.b64encode(img_data).decode("utf-8")
190 return str(inference({"question": text, "image": img_base64}))
191 @task
192 def image_to_image(model_id: str, image_file_name: str) -> str:
193 img_data = image_to_bytes(f"{DIRPATH}/{INPUT_PATH}/{image_file_name}")

Callers

nothing calls this directly

Calls 1

image_to_bytesFunction · 0.85

Tested by

no test coverage detected