Datasets-Metrics-Viewer / src /logic /graph_settings.py
hynky's picture
hynky HF staff
Refactor the code
75448af
raw
history blame
978 Bytes
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),
]