File size: 1,305 Bytes
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
"""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__))))


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")
        login_button = gr.LoginButton(value="Log in to Hugging Face")
        gr.Markdown("*Log in with your Hugging Face to be able to query models through Inference Providers.*")
    
    return {
        "login_button": login_button,
    }