import gradio as gr from functools import partial import subprocess from get_similar_profiles import get_similar_profiles from simulator import simulate from cohort_members_uk_paris import cohort_data from tech_stuff import prefix,system_prompt, how_does_it_work import os title = "EF AI Co-Finder 👀" with gr.Blocks(title=title,theme='nota-ai/theme') as demo: gr.Markdown(f"# {title}") with gr.Tab("Co-finder"): with gr.Row(): with gr.Column(scale = 10): profile_selector = gr.Dropdown(cohort_data.keys(), label="Select a profile") with gr.Column(scale = 2): nb_to_display = gr.Number(value=10,label = "Number of profiles to show") search_button = gr.Button(value="Find a match 🏹") similar_profiles = gr.Markdown("Empty") with gr.Tab("Co-founder Simulator"): with gr.Row(): with gr.Column(scale = 10): profile_selector_1 = gr.Dropdown(cohort_data.keys(), label="Select a profile") with gr.Column(scale = 10): profile_selector_2 = gr.Dropdown(cohort_data.keys(), label="Select another profile") simulator_button = gr.Button(value="Simulate 🎮") simulation_output = gr.Markdown("Empty") with gr.Tab("Geeks area 🤖🛠️"): gr.Markdown("# Config and tech details") prefix_input = gr.Textbox(value=prefix, lines=10, label="Change here the prefix appended to each profile to steer the similarity search") system_prompt_input = gr.Textbox(value=system_prompt, lines=10, label="Change here the prompt used for the simulation") gr.Markdown("## How does it work?") gr.Markdown(how_does_it_work) search_function = partial(get_similar_profiles) simulate_function = partial(simulate) search_button.click(fn=search_function, inputs=[profile_selector, prefix_input,nb_to_display], outputs=[similar_profiles]) simulator_button.click(fn=simulate_function, inputs=[profile_selector_1, profile_selector_2, system_prompt_input], outputs = [simulation_output]) login = os.environ.get("login") pwd = os.environ.get("pwd") demo.launch(max_threads=40)