Commit
·
8600eb0
1
Parent(s):
ffd08a8
Search your language
Browse files
app.py
CHANGED
@@ -44,18 +44,39 @@ def create_piechart():
|
|
44 |
|
45 |
return fig
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
with gr.Blocks() as demo:
|
49 |
gr.Markdown("## Language Leads Dashboard")
|
50 |
languages_with_lead, languages_without_lead = build_dataframes(get_covered_languages())
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
with gr.Tab("Looking for leads!"):
|
55 |
gr.Markdown("These languages don't have a lead yet! Would you like to lead one of them? Sign up using [this form](https://forms.gle/mFCMXNRjxvyFvW5q9).")
|
56 |
-
gr.DataFrame(
|
57 |
with gr.Tab("Languages with leads"):
|
58 |
gr.Markdown("We found at least one lead for these languages:")
|
59 |
-
gr.DataFrame(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
demo.launch()
|
|
|
44 |
|
45 |
return fig
|
46 |
|
47 |
+
def filter_dataframes(search_term):
|
48 |
+
filtered_with_lead = languages_with_lead[languages_with_lead['Language'] == search_term]
|
49 |
+
filtered_without_lead = languages_without_lead[languages_without_lead['Language'] == search_term]
|
50 |
+
return filtered_without_lead, filtered_with_lead
|
51 |
+
|
52 |
+
def load_demo():
|
53 |
+
languages_with_lead, languages_without_lead = build_dataframes(get_covered_languages())
|
54 |
+
piechart = create_piechart()
|
55 |
+
return languages_without_lead,languages_with_lead,piechart
|
56 |
|
57 |
with gr.Blocks() as demo:
|
58 |
gr.Markdown("## Language Leads Dashboard")
|
59 |
languages_with_lead, languages_without_lead = build_dataframes(get_covered_languages())
|
60 |
+
gr_piechart = gr.Plot(label="Language Leads")
|
61 |
+
|
62 |
+
search_box = gr.Textbox(type="text", label="Search your language:")
|
63 |
+
search_button = gr.Button("Search 🔎")
|
64 |
+
|
65 |
with gr.Tab("Looking for leads!"):
|
66 |
gr.Markdown("These languages don't have a lead yet! Would you like to lead one of them? Sign up using [this form](https://forms.gle/mFCMXNRjxvyFvW5q9).")
|
67 |
+
gr_languages_without_lead = gr.DataFrame()
|
68 |
with gr.Tab("Languages with leads"):
|
69 |
gr.Markdown("We found at least one lead for these languages:")
|
70 |
+
gr_languages_with_lead = gr.DataFrame()
|
71 |
+
|
72 |
+
demo.load(
|
73 |
+
load_demo,
|
74 |
+
outputs=[gr_languages_without_lead, gr_languages_with_lead, gr_piechart],
|
75 |
+
)
|
76 |
+
search_button.click(
|
77 |
+
fn=filter_dataframes,
|
78 |
+
inputs=search_box,
|
79 |
+
outputs=[gr_languages_without_lead,gr_languages_with_lead]
|
80 |
+
)
|
81 |
|
82 |
demo.launch()
|