Sarthakaushal commited on
Commit
74f158d
·
1 Parent(s): 62a35ad

Added explicit HFApi login call

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -33,6 +33,9 @@ class VideoAnnotator:
33
  self.annotation_repo_id = "cricverse/CricBench_Annotations"
34
  self.annotation_repo_type = "dataset"
35
  self.annotation_hf_token = os.environ.get("upload_token")
 
 
 
36
 
37
  def load_videos_from_hf(self):
38
  try:
@@ -106,12 +109,12 @@ class VideoAnnotator:
106
  # Upload the JSONL file to Hugging Face
107
  # if self.annotation_hf_token:
108
  logger.info(f"Uploading annotations to Hugging Face: {self.annotation_repo_id}")
109
- upload_file(
110
  path_or_fileobj=temp_file_path,
111
  path_in_repo=f"annotations/{video_name}.jsonl",
112
  repo_id=self.annotation_repo_id,
113
  repo_type=self.annotation_repo_type,
114
- token=self.annotation_hf_token
115
  )
116
  return f"Annotations saved and uploaded for {video_name}"
117
  # else:
 
33
  self.annotation_repo_id = "cricverse/CricBench_Annotations"
34
  self.annotation_repo_type = "dataset"
35
  self.annotation_hf_token = os.environ.get("upload_token")
36
+ if not self.annotation_hf_token:
37
+ raise ValueError("HF_ANNOTATION_TOKEN not found")
38
+ self.api = HfApi(token=self.annotation_hf_token)
39
 
40
  def load_videos_from_hf(self):
41
  try:
 
109
  # Upload the JSONL file to Hugging Face
110
  # if self.annotation_hf_token:
111
  logger.info(f"Uploading annotations to Hugging Face: {self.annotation_repo_id}")
112
+ self.api.upload_file(
113
  path_or_fileobj=temp_file_path,
114
  path_in_repo=f"annotations/{video_name}.jsonl",
115
  repo_id=self.annotation_repo_id,
116
  repo_type=self.annotation_repo_type,
117
+ # token=self.annotation_hf_token
118
  )
119
  return f"Annotations saved and uploaded for {video_name}"
120
  # else: