"""Sidebar UI component with app description and authentication.""" import os import sys import gradio as gr sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils.helpers import format_token_status def build_sidebar() -> dict: """Build the sidebar UI with app description and login.""" with gr.Sidebar(): gr.Markdown("## About") gr.Markdown( """ This interface allows you to test moderation models with custom content policies. **๐Ÿงช Testing Tab**: Enter content to test against your policy. View model predictions, categories, reasoning traces, and raw responses. Optionally save results to datasets. **๐Ÿ“‹ Policy Definition Tab**: Define your content policy by uploading a markdown file, entering it manually, or selecting from preset examples. **โš™๏ธ Configuration Tab**: Select models, adjust generation parameters, and customize system prompts and response formats. **๐Ÿ“Š Session Management Tab**: Browse and load previously saved test results. Load examples from your personal dataset or the shared ROOST dataset. """ ) gr.Markdown("---") gr.Markdown("### Authentication") token_status_markdown = gr.Markdown(value=format_token_status(None)) login_button = gr.LoginButton(value="Log in to Hugging Face") return { "login_button": login_button, "token_status": token_status_markdown, }