from typing import Literal import gradio as gr Grouping = Literal["histogram", "fqdn", "suffix", "summary"] def update_graph_options(grouping: Grouping): """ Updates visibility of the graph options based on the grouping type. The return should be in following order: group_settings, histogram_settings """ if grouping == "histogram": return [ gr.TabItem(visible=False), gr.TabItem(visible=True), gr.TabItem(visible=False), ] elif grouping in ["fqdn", "suffix"]: return [ gr.Column(visible=True), gr.Column(visible=False), gr.Column(visible=False), ] elif grouping == "summary": return [ gr.Column(visible=False), gr.Column(visible=False), gr.Column(visible=True), ] return [ gr.Column(visible=False), gr.Column(visible=False), gr.Column(visible=False), ]