(model_id: str, image_file_name: str, text: str)
| 178 | # CV tasks |
| 179 | @task |
| 180 | def visual_question_answering(model_id: str, image_file_name: str, text: str) -> str: |
| 181 | inference = InferenceApi(repo_id=model_id, token=CONFIG["huggingface"]["token"]) |
| 182 | img_data = image_to_bytes(f"{DIRPATH}/{INPUT_PATH}/{image_file_name}") |
| 183 | img_base64 = base64.b64encode(img_data).decode("utf-8") |
| 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"]) |
nothing calls this directly
no test coverage detected