| """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, |
| } |
|
|
|
|