lvwerra HF staff commited on
Commit
1795206
Β·
1 Parent(s): 1820973

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -3,18 +3,26 @@ import streamlit as st
3
 
4
 
5
  @st.cache()
6
- def get_repo_names():
7
- list_of_repo_names = load_dataset("bigcode/the-stack-paths", split="train")["repository_name"]#["lvwerra/test", "lvwerra/test2", "numpy/numpy"]
8
  return list_of_repo_names
9
 
10
  st.title("Am I in The Stack?")
11
  st.markdown("This tool lets you check if a repository under a given username is part of [The Stack dataset](https://huggingface.co/datasets/bigcode/the-stack).")
12
- repo_names = get_repo_names()
 
13
 
14
  username = st.text_input("GitHub Username:")
15
 
16
  if st.button("Check!"):
17
- list_of_repos = [repo_name for repo_name in repo_names if repo_name.split("/")[0]==username]
 
 
 
 
 
 
 
18
 
19
  if len(list_of_repos)==0:
20
  st.markdown("There is **no repository** under that username in The Stack.")
 
3
 
4
 
5
  @st.cache()
6
+ def load_all_repository_names():
7
+ list_of_repo_names = load_dataset("bigcode/the-stack-paths", split="train")["repository_name"]
8
  return list_of_repo_names
9
 
10
  st.title("Am I in The Stack?")
11
  st.markdown("This tool lets you check if a repository under a given username is part of [The Stack dataset](https://huggingface.co/datasets/bigcode/the-stack).")
12
+ repo_names = load_all_repository_names()
13
+ n_repos = len(repo_names)
14
 
15
  username = st.text_input("GitHub Username:")
16
 
17
  if st.button("Check!"):
18
+
19
+ list_of_repos = []
20
+ progress_bar = st.progress(0.0)
21
+
22
+ for i in range(n_repos):
23
+ progress_bar.progress((i + 1)/n_repos)
24
+ if repo_names[i].split("/")[0]==username:
25
+ list_of_repos.append(repo_names[i])
26
 
27
  if len(list_of_repos)==0:
28
  st.markdown("There is **no repository** under that username in The Stack.")