Răsfoiți Sursa

Update projects/multi_gpu_v2/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Xiaomeng Zhao 4 luni în urmă
părinte
comite
c08a86d6c7
1 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 3 3
      projects/multi_gpu_v2/server.py

+ 3 - 3
projects/multi_gpu_v2/server.py

@@ -43,9 +43,9 @@ class MinerUAPI(ls.LitAPI):
         options = request.get('options', {})
         
         file_bytes = base64.b64decode(file_b64)
-        temp_file = Path(tempfile.mktemp(suffix='.pdf'))
-        temp_file.write_bytes(file_bytes)
-        
+        with tempfile.NamedTemporaryFile(suffix='.pdf', delete=False) as temp:
+            temp.write(file_bytes)
+            temp_file = Path(temp.name)
         return {
             'input_path': str(temp_file),
             'backend': options.get('backend', 'pipeline'),