fixed python code

This commit is contained in:
Gabriel Almeida 2023-05-11 19:48:56 -03:00
commit 0d43a9b32b

View file

@ -49,10 +49,9 @@ export default function ApiModal({flowName}) {
API_URL = "${window.location.protocol}//${window.location.host}/predict" API_URL = "${window.location.protocol}//${window.location.host}/predict"
def predict(message): def predict(message):
with open("${flowName}.json:, "r") as f: with open("${flowName}.json", "r") as f:
json_data = json.load(f) json_data = json.load(f)
payload['exported_flow'] = json_data payload = {'exported_flow': json_data, 'message': message}
payload['message'] = message
response = requests.post(API_URL, json=payload) response = requests.post(API_URL, json=payload)
return response.json() # JSON {"result": "Response"} return response.json() # JSON {"result": "Response"}