import gradio as gr import pandas as pd df = pd.read_csv("nlp_conferences.csv") column_widths = ["18%", "20%", "17%", "15%", "30%"] 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( """ # 🚀 Conferencias de PLN Descubre las próximas conferencias de PLN. Las fechas límites son para la Main Conference. Ayúdanos a expandir esta lista. [Comenta](https://huggingface.co/spaces/somosnlp/nlp-conferences/discussions) y contribuye para hacerla lo más completa posible. ¡Gracias! """ ) 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="Conferencias de PLN", show_label=False, interactive=False, wrap=True, column_widths=column_widths, ) search_box.change(fn=update_table, inputs=search_box, outputs=table) with gr.TabItem("English"): gr.Markdown( """ # 🚀 NLP Conferences Discover the upcoming NLP conferences. Help us expand this list! [Comment](https://huggingface.co/spaces/somosnlp/nlp-conferences/discussions) and contribute to make it comprehensive. Thank you! """ ) 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="NLP Conferences", show_label=False, interactive=False, wrap=True, column_widths=column_widths, ) search_box.change(fn=update_table, inputs=search_box, outputs=table) app.launch()