meepmoo commited on
Commit
42c0ab7
·
verified ·
1 Parent(s): 7712d70

Update worker_runpod.py

Browse files
Files changed (1) hide show
  1. worker_runpod.py +6 -4
worker_runpod.py CHANGED
@@ -170,22 +170,24 @@ def generate(input):
170
 
171
  index = len([path for path in os.listdir(save_path)]) + 1
172
  prefix = str(index).zfill(8)
173
- video_path = os.path.join(save_path, f"{prefix}.mp4")
 
174
  save_videos_grid(sample, video_path, fps=fps)
175
 
176
  print("Video saved to grid, uploading to huggingface")
177
  hf_api = HfApi()
 
178
  repo_id = "meepmoo/h4h4jejdf" # Set your HF repo
179
  hf_api.upload_file(
180
  path_or_fileobj=video_path,
181
- path_in_repo=f"{prefix}.mp4",
182
  repo_id=repo_id,
183
  token=tokenxf,
184
  repo_type="model"
185
  )
186
-
187
  print("Video uploaded to huggingface returing output")
188
- result_url = f"https://huggingface.co/{repo_id}/blob/main/{prefix}.mp4"
189
  job_id = values.get("job_id", "default-job-id") # For RunPod job tracking
190
  return {"jobId": job_id, "result": result_url, "status": "DONE"}
191
 
 
170
 
171
  index = len([path for path in os.listdir(save_path)]) + 1
172
  prefix = str(index).zfill(8)
173
+ filename2 = f"{uuid.uuid4().hex}.mp4"
174
+ video_path = os.path.join(save_path, filename2)
175
  save_videos_grid(sample, video_path, fps=fps)
176
 
177
  print("Video saved to grid, uploading to huggingface")
178
  hf_api = HfApi()
179
+
180
  repo_id = "meepmoo/h4h4jejdf" # Set your HF repo
181
  hf_api.upload_file(
182
  path_or_fileobj=video_path,
183
+ path_in_repo=filename2,
184
  repo_id=repo_id,
185
  token=tokenxf,
186
  repo_type="model"
187
  )
188
+
189
  print("Video uploaded to huggingface returing output")
190
+ result_url = f"https://huggingface.co/{repo_id}/resolve/main/{filename2}"
191
  job_id = values.get("job_id", "default-job-id") # For RunPod job tracking
192
  return {"jobId": job_id, "result": result_url, "status": "DONE"}
193