rkrstacic commited on
Commit
c73da75
1 Parent(s): dc3f654

Upload api_call_module.py

Browse files
Files changed (1) hide show
  1. api_call_module.py +15 -0
api_call_module.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ url = 'https://hf.space/embed/rkrstacic/Software-module-for-answering-questions-on-processes/+/api/predict'
5
+
6
+
7
+ def _query(payload):
8
+ data = json.dumps(payload)
9
+ response = requests.request("POST", url, data=data)
10
+ return json.loads(response.content.decode("utf-8"))
11
+
12
+
13
+ def get_answer(question, process):
14
+ return _query({"data": [question, process]})["data"][0]
15
+