You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

save-dataset-qualification.py 887 B

5 months ago
123456789101112131415161718192021
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. import cgi
  4. import json
  5. import os
  6. form = cgi.FieldStorage()
  7. data = json.loads(form.getvalue("jsonData"))
  8. if os.path.isfile("notebooks/mushroom_observer/dataset-mushroom-observer/qualified-dataset/specie-id-"+form.getvalue("specieId")+".json"):
  9. with open("notebooks/mushroom_observer/dataset-mushroom-observer/qualified-dataset/specie-id-"+form.getvalue("specieId")+".json", "r") as f:
  10. previousData = json.loads(f.read())
  11. data["upSelection"] = data["upSelection"] + previousData["upSelection"]
  12. data["downSelection"] = data["downSelection"] + previousData["downSelection"]
  13. data["exclusion"] = data["exclusion"] + previousData["exclusion"]
  14. with open("notebooks/mushroom_observer/dataset-mushroom-observer/qualified-dataset/specie-id-"+form.getvalue("specieId")+".json", "w") as f:
  15. f.write(json.dumps(data))