book_extract.py 996 B

1234567891011121314151617181920212223242526272829
  1. import requests
  2. # -*- coding: utf-8 -*-
  3. async def book_extract(book_path, book_id):
  4. with open(book_path, "rb") as f:
  5. files = {"files": (book_id, f, "application/pdf")}
  6. response = requests.post(
  7. "http://192.168.100.31:8003/file_parse",
  8. headers={"accept": "application/json"},
  9. data={
  10. "return_model_output": "false",
  11. "return_md": "false",
  12. "return_images": "false",
  13. "end_page_id": "99999",
  14. "parse_method": "auto",
  15. "start_page_id": "0",
  16. "lang_list": "ch",
  17. "output_dir": "./output",
  18. "server_url": "string",
  19. "return_content_list": "true",
  20. "backend": "pipeline",
  21. "table_enable": "true",
  22. "response_format_zip": "false",
  23. "formula_enable": "true",
  24. },
  25. files=files,
  26. )
  27. return response.json()