Spaces:
Sleeping
Sleeping
| 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: | |
| # Filter the dataframe based on the search query | |
| 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: | |
| with gr.Tabs(): | |
| with gr.TabItem("Español"): | |
| gr.Markdown( | |
| """ | |
| # 🚀 Iniciativas de PLN en español | |
| Descubre las iniciativas impulsando el PLN en español y lenguas cooficiales en LATAM y España. | |
| Ayúdanos a expandir esta lista. [Comenta](https://huggingface.co/spaces/somosnlp/spanish-nlp-initiatives/discussions) y contribuye para hacerla lo más completa posible y que cada iniciativa pueda tener la visibilidad que se merece. ¡Gracias! | |
| """ | |
| ) | |
| with gr.Row(): | |
| search_box = gr.Textbox( | |
| placeholder="Buscar...", label="Filtra la tabla" | |
| ) | |
| with gr.Row(): | |
| table = gr.Dataframe( | |
| value=df, | |
| label="Iniciativas de PLN en español", | |
| 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) | |
| with gr.TabItem("English"): | |
| gr.Markdown( | |
| """ | |
| # 🚀 English NLP Initiatives | |
| Discover the initiatives driving NLP advancements in Spanish and other low-resource languages spoken in LatAm and Spain." | |
| Help us expand this list! [Comment](https://huggingface.co/spaces/somosnlp/spanish-nlp-initiatives/discussions) 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() | |