|
import gradio as gr |
|
import pandas as pd |
|
|
|
df = pd.read_csv("spanish_nlp_initiatives.csv") |
|
|
|
|
|
def update_table(search_query): |
|
if search_query == "": |
|
return df |
|
else: |
|
|
|
filtered_df = df[ |
|
df.apply( |
|
lambda row: row.astype(str) |
|
.str.contains(search_query, case=False) |
|
.any(), |
|
axis=1, |
|
) |
|
] |
|
return filtered_df |
|
|
|
|
|
with gr.Blocks() as app: |
|
gr.Markdown("# π Spanish NLP Initiatives") |
|
gr.Markdown( |
|
"Discover the initiatives driving NLP advancements in Spanish and other low-resource languages spoken in LatAm and Spain." |
|
) |
|
gr.Markdown( |
|
"Help us expand this list! Comment and contribute to make it comprehensive so every initiative gets the visibility it deserves. Thank you!" |
|
) |
|
|
|
with gr.Row(): |
|
search_box = gr.Textbox(placeholder="Type to search...", label="Search") |
|
with gr.Row(): |
|
table = gr.Dataframe( |
|
value=df, |
|
label="Spanish NLP Initiatives", |
|
show_label=False, |
|
interactive=False, |
|
wrap=True, |
|
column_widths=["40%", "20%", "10%", "25%", "15%"], |
|
) |
|
search_box.change(fn=update_table, inputs=search_box, outputs=table) |
|
|
|
app.launch() |
|
|