File size: 1,365 Bytes
e562ce4
 
 
 
 
 
 
 
 
bc0c2e4
 
e562ce4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc0c2e4
e562ce4
 
 
 
bc0c2e4
e562ce4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""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.
            
            **📋 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.
            """
        )
        
        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,
    }