import gradio as gr from .chat_interface import create_chat_interface from .tab_examples import create_examples_tab from .tab_papers import create_papers_tab from .tab_figures import create_figures_tab def cqa_tab(tab_name): # State variables current_graphs = gr.State([]) with gr.Tab(tab_name): with gr.Row(elem_id="chatbot-row"): # Left column - Chat interface with gr.Column(scale=2): chatbot, textbox, config_button = create_chat_interface(tab_name) # Right column - Content panels with gr.Column(scale=2, variant="panel", elem_id="right-panel"): with gr.Tabs(elem_id="right_panel_tab") as tabs: # Examples tab with gr.TabItem("Examples", elem_id="tab-examples", id=0): examples_hidden, dropdown_samples, samples = create_examples_tab() # Sources tab with gr.Tab("Sources", elem_id="tab-sources", id=1) as tab_sources: sources_textbox = gr.HTML(show_label=False, elem_id="sources-textbox") # Recommended content tab with gr.Tab("Recommended content", elem_id="tab-recommended_content", id=2) as tab_recommended_content: with gr.Tabs(elem_id="group-subtabs") as tabs_recommended_content: # Figures subtab with gr.Tab("Figures", elem_id="tab-figures", id=3) as tab_figures: sources_raw, new_figures, used_figures, gallery_component, figures_cards, figure_modal = create_figures_tab() # Papers subtab with gr.Tab("Papers", elem_id="tab-citations", id=4) as tab_papers: papers_summary, papers_html, citations_network, papers_modal = create_papers_tab() # Graphs subtab with gr.Tab("Graphs", elem_id="tab-graphs", id=5) as tab_graphs: graphs_container = gr.HTML( "