|
import os |
|
import gradio as gr |
|
from functools import partial |
|
import re |
|
from src.view.help_tab import create_help_tab |
|
from src.view.metric_view_tab import create_metric_view_tab |
|
from src.view.reverse_search_tab import create_reverse_search_tab |
|
from src.logic.data_fetching import fetch_datasets, fetch_groups, fetch_metrics, reverse_search, reverse_search_add |
|
|
|
METRICS_LOCATION_DEFAULT = os.getenv("METRICS_LOCATION_DEFAULT", "hf://HuggingFaceFW/Datasets-Metrics-Viewer-Data/datasets") |
|
|
|
def create_interface(): |
|
with gr.Blocks() as demo: |
|
metrics_headline = gr.Markdown(value="# Datasets Metrics Explorer") |
|
available_datasets = gr.State([]) |
|
|
|
with gr.Tabs(): |
|
with gr.Tab("Help"): |
|
create_help_tab() |
|
|
|
with gr.TabItem("Metric View"): |
|
base_folder, selected_datasets = create_metric_view_tab(METRICS_LOCATION_DEFAULT, available_datasets) |
|
|
|
with gr.TabItem("Reverse Metrics Search"): |
|
create_reverse_search_tab(base_folder, available_datasets, selected_datasets) |
|
|
|
return demo |