karimouda commited on
Commit
3b20ce8
·
1 Parent(s): a63f3ca

fix update queue file

Browse files
Files changed (1) hide show
  1. src/submission/submit.py +13 -11
src/submission/submit.py CHANGED
@@ -108,29 +108,31 @@ def add_new_eval(
108
 
109
 
110
  ##update queue file
111
- queue_file = "./eval_queue.json"
112
-
113
  ## download queue_file from repo using huggun face hub API, update it and upload again
114
  queue_file = hf_hub_download(
115
- path_in_repo=queue_file,
116
  repo_id=QUEUE_REPO,
117
  repo_type="space",
118
- revision="main",
119
- )
 
 
120
  with open(queue_file, "r") as f:
121
  queue_data = json.load(f)
122
  if len(queue_data) == 0:
123
  queue_data = []
124
  queue_data.append(eval_entry)
125
- with open(queue_file, "w") as f:
126
- json.dump(queue_data, f)
 
127
  print("Updating queue file")
128
  API.upload_file(
129
- path_or_fileobj=queue_file,
130
- path_in_repo=queue_file,
131
  repo_id=QUEUE_REPO,
132
- repo_type="space",
133
- commit_message=f"Update eval queue with {model}",
134
  )
135
 
136
 
 
108
 
109
 
110
  ##update queue file
111
+ queue_file_path = "./eval_queue.json"
112
+ print(TOKEN)
113
  ## download queue_file from repo using huggun face hub API, update it and upload again
114
  queue_file = hf_hub_download(
115
+ filename=queue_file_path,
116
  repo_id=QUEUE_REPO,
117
  repo_type="space",
118
+ token=TOKEN
119
+ )
120
+
121
+
122
  with open(queue_file, "r") as f:
123
  queue_data = json.load(f)
124
  if len(queue_data) == 0:
125
  queue_data = []
126
  queue_data.append(eval_entry)
127
+ print(queue_data)
128
+ #with open(queue_file, "w") as f:
129
+ # json.dump(queue_data, f)
130
  print("Updating queue file")
131
  API.upload_file(
132
+ path_or_fileobj=json.dumps(queue_data, indent=2).encode("utf-8"),
133
+ path_in_repo=queue_file_path,
134
  repo_id=QUEUE_REPO,
135
+ repo_type="space"
 
136
  )
137
 
138