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.Accordion(label="Leer más", open=False): gr.Markdown( """ En los últimos años han surgido iniciativas para impulsar el PLN en español. El objetivo de esta lista es dar a conocer estas iniciativas y facilitar la colaboración entre personas apasionadas por el PLN en diferentes lugares del mundo. La lista no es exhaustiva y son más que bienvenidas las contribuciones vía [comentarios o PRs](https://huggingface.co/spaces/somosnlp/spanish-nlp-initiatives/discussions) o [Twitter](https://twitter.com/SomosNLP_/status/1777744175120703605). Estructura: - Name: Nombre de la iniciativa - Language: Lenguas en las que se enfoca la iniciativa (LATAM = lenguas cooficiales de LATAM, ES = lenguas cooficiales de España) - Type: Tipo de iniciativa (proyecto, evento, comunidad, asociación, empresa open-source) - Country: Países en lo que se realiza la mayor parte de las actividades de la iniciativa - URL: Página web de la iniciativa """ ) with gr.Row(): search_box = gr.Textbox( placeholder="Buscar...", label="Filtra la tabla", show_label=False, ) 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%", "15%", "15%", "20%", "20%"], ) 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.Accordion(label="Read more", open=False): gr.Markdown( """ In recent years, several initiatives have emerged to promote NLP in Spanish. The purpose of this list is to give visibility to these initiatives and to facilitate the collaboration among NLP enthusiasts in different parts of the world. The list is not exhaustive, and contributions via [comments or PRs](https://huggingface.co/spaces/somosnlp/spanish-nlp-initiatives/discussions) are more than welcome. Structure: - Name: Name of the initiative - Language: Languages the initiative focuses on (LATAM = co-official languages in LATAM, ES = co-official languages in Spain) - Type: Type of initiative (project, event, community, association, open-source company) - Country: Countries where most of the initiative's activities take place - URL: Website of the initiative """ ) with gr.Row(): search_box = gr.Textbox( placeholder="Type to search...", label="Search", show_label=False ) with gr.Row(): table = gr.Dataframe( value=df, label="Spanish NLP Initiatives", show_label=False, interactive=False, wrap=True, column_widths=["40%", "15%", "15%", "20%", "20%"], ) search_box.change(fn=update_table, inputs=search_box, outputs=table) app.launch()