akhaliq HF Staff commited on
Commit
5d7cc0b
·
1 Parent(s): 35169fd

transformers js deploy fix

Browse files
Files changed (1) hide show
  1. backend_deploy.py +2 -0
backend_deploy.py CHANGED
@@ -596,7 +596,9 @@ def deploy_to_huggingface_space(
596
  # Create a NEW temp file for this upload (key difference from old approach)
597
  with tempfile.NamedTemporaryFile("w", suffix=f".{file_name.split('.')[-1]}", delete=False, encoding='utf-8') as f:
598
  f.write(file_content)
 
599
  temp_file_path = f.name
 
600
 
601
  # Upload the file without commit_message (HF handles this for spaces)
602
  api.upload_file(
 
596
  # Create a NEW temp file for this upload (key difference from old approach)
597
  with tempfile.NamedTemporaryFile("w", suffix=f".{file_name.split('.')[-1]}", delete=False, encoding='utf-8') as f:
598
  f.write(file_content)
599
+ f.flush() # Ensure all content is written to disk before closing
600
  temp_file_path = f.name
601
+ # File is now closed and flushed, safe to upload
602
 
603
  # Upload the file without commit_message (HF handles this for spaces)
604
  api.upload_file(