Spaces:
Running
Running
convert to asyncion processing
Browse files
services/__pycache__/workers.cpython-312.pyc
CHANGED
|
Binary files a/services/__pycache__/workers.cpython-312.pyc and b/services/__pycache__/workers.cpython-312.pyc differ
|
|
|
services/workers.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
|
|
|
| 3 |
import tempfile
|
| 4 |
import httpx
|
| 5 |
from datetime import datetime, timezone
|
|
@@ -36,7 +37,7 @@ class CvWorker:
|
|
| 36 |
tmp.write(file_bytes)
|
| 37 |
tmp_path = Path(tmp.name)
|
| 38 |
|
| 39 |
-
conversion = self.converter.convert
|
| 40 |
|
| 41 |
if not conversion.success:
|
| 42 |
error_msg = conversion.error or "Conversion failed"
|
|
@@ -48,7 +49,7 @@ class CvWorker:
|
|
| 48 |
}, callback_secret)
|
| 49 |
return
|
| 50 |
|
| 51 |
-
chunks =
|
| 52 |
end_time = datetime.now(timezone.utc).isoformat()
|
| 53 |
|
| 54 |
payload = {
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
import asyncio
|
| 4 |
import tempfile
|
| 5 |
import httpx
|
| 6 |
from datetime import datetime, timezone
|
|
|
|
| 37 |
tmp.write(file_bytes)
|
| 38 |
tmp_path = Path(tmp.name)
|
| 39 |
|
| 40 |
+
conversion = await asyncio.to_thread(self.converter.convert, tmp_path)
|
| 41 |
|
| 42 |
if not conversion.success:
|
| 43 |
error_msg = conversion.error or "Conversion failed"
|
|
|
|
| 49 |
}, callback_secret)
|
| 50 |
return
|
| 51 |
|
| 52 |
+
chunks = await asyncio.to_thread(chunk_cv, conversion.markdown)
|
| 53 |
end_time = datetime.now(timezone.utc).isoformat()
|
| 54 |
|
| 55 |
payload = {
|