Spaces:
Running
Running
Yacine Jernite
commited on
Commit
Β·
b5c6a72
1
Parent(s):
9e65b63
login fix maybe
Browse files- app.py +26 -0
- ui/sidebar.py +3 -1
app.py
CHANGED
|
@@ -258,6 +258,19 @@ with gr.Blocks(title="Moderation Model Testing") as demo:
|
|
| 258 |
]
|
| 259 |
)
|
| 260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
# Dataset load handler
|
| 262 |
def load_example_from_dataset(selected_label, cached_examples_list, dropdown_choices_list):
|
| 263 |
"""Load example from dataset and populate all fields."""
|
|
@@ -327,6 +340,19 @@ with gr.Blocks(title="Moderation Model Testing") as demo:
|
|
| 327 |
],
|
| 328 |
)
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
|
| 331 |
if __name__ == "__main__":
|
| 332 |
demo.launch(ssr_mode=False)
|
|
|
|
| 258 |
]
|
| 259 |
)
|
| 260 |
|
| 261 |
+
# Update token status on app load (when OAuth token is already available)
|
| 262 |
+
demo.load(
|
| 263 |
+
handle_login_click,
|
| 264 |
+
inputs=None, # OAuth token auto-injected
|
| 265 |
+
outputs=[
|
| 266 |
+
token_status_markdown,
|
| 267 |
+
save_mode_help,
|
| 268 |
+
refresh_private_btn,
|
| 269 |
+
refresh_roost_btn,
|
| 270 |
+
dataset_help_text,
|
| 271 |
+
]
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
# Dataset load handler
|
| 275 |
def load_example_from_dataset(selected_label, cached_examples_list, dropdown_choices_list):
|
| 276 |
"""Load example from dataset and populate all fields."""
|
|
|
|
| 340 |
],
|
| 341 |
)
|
| 342 |
|
| 343 |
+
# Update token status on app load (when OAuth token is already available)
|
| 344 |
+
demo.load(
|
| 345 |
+
handle_login_click,
|
| 346 |
+
inputs=None, # OAuth token auto-injected
|
| 347 |
+
outputs=[
|
| 348 |
+
token_status_markdown,
|
| 349 |
+
save_mode_help,
|
| 350 |
+
refresh_private_btn,
|
| 351 |
+
refresh_roost_btn,
|
| 352 |
+
dataset_help_text,
|
| 353 |
+
]
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
|
| 357 |
if __name__ == "__main__":
|
| 358 |
demo.launch(ssr_mode=False)
|
ui/sidebar.py
CHANGED
|
@@ -18,11 +18,13 @@ def build_sidebar() -> dict:
|
|
| 18 |
"""
|
| 19 |
This interface allows you to test moderation models with custom content policies.
|
| 20 |
|
| 21 |
-
**π§ͺ Testing Tab**: Enter content to test against your policy. View model predictions, categories, reasoning traces, and raw responses.
|
| 22 |
|
| 23 |
**π Policy Definition Tab**: Define your content policy by uploading a markdown file, entering it manually, or selecting from preset examples.
|
| 24 |
|
| 25 |
**βοΈ Configuration Tab**: Select models, adjust generation parameters, and customize system prompts and response formats.
|
|
|
|
|
|
|
| 26 |
"""
|
| 27 |
)
|
| 28 |
|
|
|
|
| 18 |
"""
|
| 19 |
This interface allows you to test moderation models with custom content policies.
|
| 20 |
|
| 21 |
+
**π§ͺ Testing Tab**: Enter content to test against your policy. View model predictions, categories, reasoning traces, and raw responses. Optionally save results to datasets.
|
| 22 |
|
| 23 |
**π Policy Definition Tab**: Define your content policy by uploading a markdown file, entering it manually, or selecting from preset examples.
|
| 24 |
|
| 25 |
**βοΈ Configuration Tab**: Select models, adjust generation parameters, and customize system prompts and response formats.
|
| 26 |
+
|
| 27 |
+
**π Session Management Tab**: Browse and load previously saved test results. Load examples from your personal dataset or the shared ROOST dataset.
|
| 28 |
"""
|
| 29 |
)
|
| 30 |
|