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.

28 lines
547 B

  1. from celery import shared_task
  2. from django.conf import settings
  3. from django_drf_filepond.api import store_upload
  4. from django_drf_filepond.models import TemporaryUpload
  5. from .models import Document, Label
  6. @shared_task
  7. def add(x, y):
  8. return x + y
  9. @shared_task
  10. def mul(x, y):
  11. return x * y
  12. @shared_task
  13. def xsum(numbers):
  14. return sum(numbers)
  15. @shared_task
  16. def parse(upload_id):
  17. tu = TemporaryUpload.objects.get(upload_id=upload_id)
  18. su = store_upload(upload_id, destination_file_path=tu.upload_name)
  19. return su.file.path