Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from collections import defaultdict
|
|
| 4 |
|
| 5 |
df = pd.read_csv("./stackv2_languages.csv")
|
| 6 |
|
| 7 |
-
langs = list(df["language"].unique())
|
| 8 |
exts = list(df["extension"].unique())
|
| 9 |
|
| 10 |
|
|
@@ -18,14 +18,14 @@ def compute(lang):
|
|
| 18 |
report = f"## Summary:\n\n The '{lang}' language has {len(lang_to_ext[lang])} extensions: {', '.join(lang_to_ext[lang])}.\n\n"
|
| 19 |
df_lang = df[df["language"]==lang]
|
| 20 |
|
| 21 |
-
for i, (ext, example) in enumerate(zip(df["extension"], df["
|
| 22 |
example_string = f"Example {i+1} (ext={ext}):\n\n ```\n{example}\n```\n\n"
|
| 23 |
report += example_string
|
| 24 |
|
| 25 |
return report.strip()
|
| 26 |
|
| 27 |
with gr.Blocks() as demo:
|
| 28 |
-
gr.Markdown("# Programming Languages for The Stack v2")
|
| 29 |
|
| 30 |
lang_select = gr.Dropdown(choices=langs)
|
| 31 |
md = gr.Markdown("")
|
|
|
|
| 4 |
|
| 5 |
df = pd.read_csv("./stackv2_languages.csv")
|
| 6 |
|
| 7 |
+
langs = sorted(list(df["language"].unique()))
|
| 8 |
exts = list(df["extension"].unique())
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
report = f"## Summary:\n\n The '{lang}' language has {len(lang_to_ext[lang])} extensions: {', '.join(lang_to_ext[lang])}.\n\n"
|
| 19 |
df_lang = df[df["language"]==lang]
|
| 20 |
|
| 21 |
+
for i, (ext, example) in enumerate(zip(df["extension"], df["content"])):
|
| 22 |
example_string = f"Example {i+1} (ext={ext}):\n\n ```\n{example}\n```\n\n"
|
| 23 |
report += example_string
|
| 24 |
|
| 25 |
return report.strip()
|
| 26 |
|
| 27 |
with gr.Blocks() as demo:
|
| 28 |
+
gr.Markdown(f"# Programming Languages for The Stack v2\n\nIn total there are **{len(langs)} languages** and **{len(exts)} extensions.**")
|
| 29 |
|
| 30 |
lang_select = gr.Dropdown(choices=langs)
|
| 31 |
md = gr.Markdown("")
|