taishi-i commited on
Commit
129744f
1 Parent(s): 2ffaad6

update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -3
app.py CHANGED
@@ -85,8 +85,10 @@ def main():
85
  with st.sidebar:
86
  st.title(f"{title} {icon}")
87
  st.markdown(
88
- "You can search for open-source software from [1250+ Japanese NLP repositories](https://github.com/taishi-i/awesome-japanese-nlp-resources)."
 
89
  )
 
90
  query = st.text_input(label="Search keyword")
91
 
92
  source_type = ["GitHub", "Hugging Face"]
@@ -156,6 +158,13 @@ def main():
156
  value=(min(years), max(years)),
157
  )
158
 
 
 
 
 
 
 
 
159
  df = df[
160
  (df["year"] >= selected_year_range[0])
161
  & (df["year"] <= selected_year_range[1])
@@ -199,6 +208,18 @@ def main():
199
  )
200
  ]
201
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  # Main streamlit page (columns)
203
  col1, col2 = st.columns(2, gap="large")
204
 
@@ -215,7 +236,8 @@ def main():
215
  min_value = int(df[stats_key].min())
216
  max_value = int(df[stats_key].max())
217
  st.markdown(
218
- f"#### {stats_key} mean: {int(mean_value)}, min: {min_value}, max: {max_value}"
 
219
  )
220
 
221
  st.dataframe(df, height=600)
@@ -309,7 +331,10 @@ def main():
309
  tooltip=["year", "project_count"],
310
  )
311
  .properties(
312
- title="Number of projects per year based on the uear of the first commit",
 
 
 
313
  width=600,
314
  height=400,
315
  )
 
85
  with st.sidebar:
86
  st.title(f"{title} {icon}")
87
  st.markdown(
88
+ "You can search for open-source software from [1250+ Japanese NLP"
89
+ " repositories](https://github.com/taishi-i/awesome-japanese-nlp-resources)."
90
  )
91
+
92
  query = st.text_input(label="Search keyword")
93
 
94
  source_type = ["GitHub", "Hugging Face"]
 
158
  value=(min(years), max(years)),
159
  )
160
 
161
+ st.markdown("Sorted by")
162
+ num_show_repos = st.number_input(
163
+ "Number of sorted repositories", value=15
164
+ )
165
+ latest_repos_btn = st.button("Latest repositories")
166
+ trend_repos_btn = st.button("Trend repositories")
167
+
168
  df = df[
169
  (df["year"] >= selected_year_range[0])
170
  & (df["year"] <= selected_year_range[1])
 
208
  )
209
  ]
210
 
211
+ if latest_repos_btn:
212
+ df = df.sort_values(by="first_commit", ascending=False)
213
+ df = df[:num_show_repos]
214
+
215
+ if trend_repos_btn:
216
+ if selected_source_type == "GitHub":
217
+ stats_key = "stargazers_count"
218
+ else:
219
+ stats_key = "downloads"
220
+ df = df.sort_values(by=stats_key, ascending=False)
221
+ df = df[:num_show_repos]
222
+
223
  # Main streamlit page (columns)
224
  col1, col2 = st.columns(2, gap="large")
225
 
 
236
  min_value = int(df[stats_key].min())
237
  max_value = int(df[stats_key].max())
238
  st.markdown(
239
+ f"#### {stats_key} mean: {int(mean_value)}, min: {min_value},"
240
+ f" max: {max_value}"
241
  )
242
 
243
  st.dataframe(df, height=600)
 
331
  tooltip=["year", "project_count"],
332
  )
333
  .properties(
334
+ title=(
335
+ "Number of projects per year based on the uear of the"
336
+ " first commit"
337
+ ),
338
  width=600,
339
  height=400,
340
  )