anton-l HF Staff commited on
Commit
b82744b
Β·
verified Β·
1 Parent(s): 33186b5

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +12 -72
  3. banner.png +0 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
  *.duckdb filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
  *.duckdb filter=lfs diff=lfs merge=lfs -text
36
+ banner.png filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,10 +1,4 @@
1
  import gradio as gr
2
- from huggingface_hub import hf_hub_download
3
- import gzip
4
- import urllib
5
- import duckdb
6
-
7
- db = duckdb.connect("repos.duckdb")
8
 
9
  text = """\
10
  ![](https://huggingface.co/spaces/lvwerra/in-the-stack-gr/resolve/main/banner.png)
@@ -13,7 +7,6 @@ text = """\
13
  # Am I in The Stack?
14
 
15
  As part of the BigCode project, we released and maintain [The Stack V2](https://huggingface.co/datasets/bigcode/the-stack-v2), a 67 TB dataset of source code over 600 programming languages. One of our goals in this project is to give people agency over their source code by letting them decide whether or not it should be used to develop and evaluate machine learning models, as we acknowledge that not all developers may wish to have their data used for that purpose.
16
- """ + """\
17
 
18
  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). Note that previous opt-outs might still be displayed in the release candidate (denoted with "-rc"), which will be removed for the release.
19
 
@@ -22,77 +15,24 @@ This tool lets you check if a repository under a given username is part of The S
22
  **Data source**:\
23
  <img src="https://annex.softwareheritage.org/public/logo/software-heritage-logo-title.2048px.png" alt="Logo" style="height: 3em; vertical-align: middle;" />
24
 
25
- **Model training**:\
26
-
27
- - StarCoder1 was trained on repos listed in `v1.2`.
28
- - StarCoder2 was trained on repos listed in `v2.0.1`.
29
-
30
  """
31
- opt_out_text_template = """\
32
- ### Opt-out
33
-
34
- If you want your data to be removed from the stack and model training \
35
- open an issue with <a href="https://github.com/bigcode-project/opt-out-v2/issues/new?title={title}&body={body}" target="_blank">this link</a> \
36
- (if the link doesn't work try right a right click and open it in a new tab) or visit [https://github.com/bigcode-project/opt-out-v2/issues/new?&template=opt-out-request.md](https://github.com/bigcode-project/opt-out-v2/issues/new?&template=opt-out-request.md) .\
37
- """
38
-
39
- opt_out_issue_title = """Opt-out request for {username}"""
40
- opt_out_issue_body = """\
41
- I request that the following data is removed from The Stack and StackOverflow:
42
-
43
- - Commits
44
- - GitHub issue
45
- - StackOverflow: <INSERT_STACKOVERFLOW_USERNAME_HERE>
46
- {repo_list}
47
 
48
- _Note_: If you don't want all resources to be included just remove the elements from the list above. If you would like to exclude all repositories and resources just add a single element "all" to the list.
 
 
 
 
 
 
 
 
49
  """
50
 
51
- def issue_url(username, repos):
52
- title = urllib.parse.quote(opt_out_issue_title.format(username=username))
53
- body = urllib.parse.quote(opt_out_issue_body.format(repo_list=" - "+ "\n - ".join(repos)))
54
-
55
- opt_out_text = opt_out_text_template.format(title=title, body=body)
56
-
57
- return opt_out_text
58
-
59
- def check_username(username, version):
60
- username = username.lower()
61
- output_md = ""
62
- repos = db.sql(f"SELECT repo FROM repos WHERE user='{username}' AND version='{version}' ORDER BY repo").fetchall()
63
- repos = [repo[0] for repo in repos]
64
-
65
- if repos:
66
- repo_word = "repository" if len(repos)==1 else "repositories"
67
- if version[:2] == "v2":
68
- output_md += f"**Yes**, there is code from **{len(repos)} {repo_word}** in The Stack. Check the links to see when it was archived by Software Heritage:\n\n"
69
- else:
70
- output_md += f"**Yes**, there is code from **{len(repos)} {repo_word}** in The Stack:\n\n"
71
- for repo in repos:
72
- if version[:2] == "v2":
73
- output_md += f"[{repo}](https://archive.softwareheritage.org/browse/origin/visits/?origin_url=https://github.com/{repo})\n\n"
74
- else:
75
- output_md += f"_{repo}_\n\n"
76
-
77
- return output_md.strip(), issue_url(username, repos)
78
- else:
79
- output_md += "**No**, your code is not in The Stack."
80
- return output_md.strip(), ""
81
-
82
  with gr.Blocks() as demo:
83
  with gr.Row():
84
- _, colum_2, _ = gr.Column(scale=1), gr.Column(scale=6), gr.Column(scale=1)
85
- with colum_2:
86
  gr.Markdown(text)
87
- version = gr.Dropdown(["v2.1.0", "v2.0.1", "v2.0", "v1.2", "v1.1", "v1.0"], label="The Stack version:", value="v2.1.0")
88
- username = gr.Text("", label="Your GitHub username:")
89
- check_button = gr.Button("Check!")
90
-
91
- repos = gr.Markdown()
92
- opt_out = gr.Markdown()
93
-
94
-
95
- check_button.click(check_username, [username, version], [repos, opt_out])
96
-
97
 
98
  demo.launch()
 
1
  import gradio as gr
 
 
 
 
 
 
2
 
3
  text = """\
4
  ![](https://huggingface.co/spaces/lvwerra/in-the-stack-gr/resolve/main/banner.png)
 
7
  # Am I in The Stack?
8
 
9
  As part of the BigCode project, we released and maintain [The Stack V2](https://huggingface.co/datasets/bigcode/the-stack-v2), a 67 TB dataset of source code over 600 programming languages. One of our goals in this project is to give people agency over their source code by letting them decide whether or not it should be used to develop and evaluate machine learning models, as we acknowledge that not all developers may wish to have their data used for that purpose.
 
10
 
11
  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). Note that previous opt-outs might still be displayed in the release candidate (denoted with "-rc"), which will be removed for the release.
12
 
 
15
  **Data source**:\
16
  <img src="https://annex.softwareheritage.org/public/logo/software-heritage-logo-title.2048px.png" alt="Logo" style="height: 3em; vertical-align: middle;" />
17
 
 
 
 
 
 
18
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ banner = """\
21
+ <div style="border: 2px solid #e91e8c; border-radius: 8px; padding: 16px 20px; background-color: #fdf0f7;">
22
+ <p style="margin: 0; font-size: 1.1em;">
23
+ <strong>The Stack v3 is now available and is a superset of v1 and v2.</strong><br>
24
+ To check if your repositories are included and to request an opt-out, please visit
25
+ <a href="https://huggingface.co/spaces/HuggingFaceCode/in-the-stack" target="_blank">
26
+ Am I in The Stack?</a>
27
+ </p>
28
+ </div>
29
  """
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  with gr.Blocks() as demo:
32
  with gr.Row():
33
+ _, col, _ = gr.Column(scale=1), gr.Column(scale=6), gr.Column(scale=1)
34
+ with col:
35
  gr.Markdown(text)
36
+ gr.HTML(banner)
 
 
 
 
 
 
 
 
 
37
 
38
  demo.launch()
banner.png CHANGED

Git LFS Details

  • SHA256: c89d4c93722470142e01f22d5a4e1197e08ed76c84257cdf86f2582baafc229c
  • Pointer size: 131 Bytes
  • Size of remote file: 181 kB