import gradio as gr from functools import partial from get_similar_program import search_programs import pandas as pd title = "Planeta Sales Copilot Confidential Demo [Tatooine] 🛫" desc = "IA copilot pour comerciaux. Cette application permet, a partir de la description d'un profil de chercher rapidement dans un vaste catalogue de formation celle qui est la plus pertinente" # "This is a tool that helps you find quickly relevant Formations on a topic or a problem you have. Just type in plain English what you are looking for in the box below.\n\n" with gr.Blocks(title=title) as demo: gr.Markdown(f"# {title}") with gr.Row(): with gr.Column(scale=8): gr.Markdown("**"+desc+"**") # with gr.Column(scale=8): # status = gr.Markdown("## Statut du prospect") gr.Markdown("## Catalogue de formation") # with gr.Column(scale=4): with gr.Row(): with gr.Column(scale = 8): text_area = gr.Textbox(placeholder="Ecrivez ici", lines=3, label="Décrivez le profil de votre prospect") with gr.Accordion("Tous les résultats:", ): output = gr.Markdown("Vide") with gr.Column(scale = 2): search_button = gr.Button(value="Trouver des Formations") number_to_display = gr.Number(value=10,label = "Nombre de Formations à afficher") augment = gr.Checkbox(label = "Enrichir le profil [IA] (Peut mettre plusieurs secondes))", info="Utiliser l'IA pour enrichir la description du profil") filter = gr.CheckboxGroup(['OBS', 'UNIBA', 'OSTELEA','VIU', 'ESLSCA', 'EAE','ESDESIGN,', 'EGE', 'EDC','SMS', 'SUP DE LUXE', 'IFP','INESDI', 'ROME BUSINESS SCHOOL','BARCELONA CULINARY HUB'], value = ['OBS', 'UNIBA', 'OSTELEA','VIU', 'ESLSCA', 'EAE','ESDESIGN,', 'EGE', 'EDC','SMS', 'SUP DE LUXE', 'IFP','INESDI', 'ROME BUSINESS SCHOOL','BARCELONA CULINARY HUB'], label="Ecole", info="Filtrer par école") search_function = partial(search_programs) search_button.click(fn=search_function, inputs=[text_area,number_to_display, augment, filter], outputs=[output]) demo.launch(max_threads=40, show_error=True)