invoke1.py 548 B

1234567891011121314151617181920
  1. import requests
  2. cmd_str = """
  3. def run(kwargs):
  4. import numpy as np
  5. from sklearn import preprocessing
  6. x = kwargs['x']
  7. min_max_scaler = preprocessing.MinMaxScaler()
  8. x_minmax = min_max_scaler.fit_transform(np.array(x).reshape(-1, 2))
  9. return x_minmax
  10. """
  11. s = [[1, 20, 30, 40, 5, 6, 7, 8, 9, 10], [1, 20, 30, 40, 5, 6, 7, 8, 9, 10]]
  12. kkk = {'x': s}
  13. print(requests.post("http://172.18.248.152:8000/exec", json={
  14. "function_str": cmd_str,
  15. "call_str": "run(kwargs)",
  16. "param_dict": {
  17. "kwargs": kkk
  18. }
  19. }).json())