Spaces:
Running
Running
| """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, | |
| } | |