lvwerra HF staff commited on
Commit
d1dbd28
1 Parent(s): 2610e3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -6,9 +6,9 @@ import json
6
  import time
7
 
8
 
9
- @st.experimental_memo
10
- def load_all_usernames():
11
- filepath = hf_hub_download(repo_id="bigcode/the-stack-username-to-repo", filename="username_to_repo.json.gz", repo_type="dataset")
12
 
13
  with gzip.open(filepath, 'r') as f:
14
  usernames = json.loads(f.read().decode('utf-8'))
@@ -22,13 +22,10 @@ st.markdown("As part of the BigCode project, we released and maintain [The Stack
22
 
23
  st.markdown("This tool lets you check if a repository under a given username is part of The Stack dataset. Would you like to have your data removed from future versions of The Stack? You can opt-out following the instructions [here](https://www.bigcode-project.org/docs/about/the-stack/#how-can-i-request-that-my-data-be-removed-from-the-stack).")
24
 
25
-
26
- usernames = load_all_usernames()
27
  username = st.text_input("Your GitHub Username:")
28
 
29
-
30
-
31
- if username or st.button("Check!"):
32
  if username in usernames:
33
  repos = usernames[username]
34
  repo_word = "repository" if len(repos)==1 else "repositories"
 
6
  import time
7
 
8
 
9
+ @st.cache(allow_output_mutation=True)
10
+ def load_all_usernames(filename):
11
+ filepath = hf_hub_download(repo_id="bigcode/the-stack-username-to-repo", filename=filename, repo_type="dataset")
12
 
13
  with gzip.open(filepath, 'r') as f:
14
  usernames = json.loads(f.read().decode('utf-8'))
 
22
 
23
  st.markdown("This tool lets you check if a repository under a given username is part of The Stack dataset. Would you like to have your data removed from future versions of The Stack? You can opt-out following the instructions [here](https://www.bigcode-project.org/docs/about/the-stack/#how-can-i-request-that-my-data-be-removed-from-the-stack).")
24
 
25
+ usernames = load_all_usernames("username_to_repo.json.gz")
 
26
  username = st.text_input("Your GitHub Username:")
27
 
28
+ if st.button("Check!") or username:
 
 
29
  if username in usernames:
30
  repos = usernames[username]
31
  repo_word = "repository" if len(repos)==1 else "repositories"