import requests import json url = 'https://hf.space/embed/rkrstacic/Software-module-for-answering-questions-on-processes/+/api/predict' def _query(payload): data = json.dumps(payload) response = requests.request("POST", url, data=data) return json.loads(response.content.decode("utf-8")) def get_answer(question, process): return _query({"data": [question, process]})["data"][0]