julien-c HF staff commited on
Commit
f4f11ee
1 Parent(s): 9bf11f8

Make saving dataset public (but do not log private models)

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +4 -2
README.md CHANGED
@@ -9,7 +9,8 @@ app_file: app.py
9
  pinned: true
10
  license: apache-2.0
11
  models: []
12
- datasets: []
 
13
  ---
14
 
15
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
9
  pinned: true
10
  license: apache-2.0
11
  models: []
12
+ datasets:
13
+ - safetensors/conversions
14
  ---
15
 
16
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -28,11 +28,13 @@ def run(token: str, model_id: str) -> str:
28
  """
29
  try:
30
  api = HfApi(token=token)
 
 
31
  commit_info = convert(api=api, model_id=model_id)
32
  print("[commit_info]", commit_info)
33
 
34
- # save in a private dataset:
35
- if repo is not None:
36
  repo.git_pull(rebase=True)
37
  with open(DATA_FILE, "a") as csvfile:
38
  writer = csv.DictWriter(
 
28
  """
29
  try:
30
  api = HfApi(token=token)
31
+ is_private = api.model_info(model_id=model_id).private
32
+
33
  commit_info = convert(api=api, model_id=model_id)
34
  print("[commit_info]", commit_info)
35
 
36
+ # save in a (public) dataset:
37
+ if repo is not None and not is_private:
38
  repo.git_pull(rebase=True)
39
  with open(DATA_FILE, "a") as csvfile:
40
  writer = csv.DictWriter(