Spaces:
Sleeping
Sleeping
Hide dataset editor and standard verification tabs
Browse files
src/interface/simplified_gradio_app.py
CHANGED
|
@@ -124,157 +124,10 @@ def create_simplified_interface():
|
|
| 124 |
# Main interface - using Tabs with elem_id for navigation
|
| 125 |
main_tabs = gr.Tabs(elem_id="main_tabs")
|
| 126 |
with main_tabs:
|
| 127 |
-
#
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
if is_feature_enabled("show_mode_navigation_hints") and is_feature_enabled("standard_verification_enabled"):
|
| 132 |
-
with gr.Row():
|
| 133 |
-
gr.Markdown("""
|
| 134 |
-
<div style="padding: 0.75em; background-color: #eff6ff; border-radius: 8px; border-left: 4px solid #3b82f6; margin-bottom: 1em;">
|
| 135 |
-
<strong>π‘ Tip:</strong> For quick dataset verification without editing capabilities, use the
|
| 136 |
-
<strong>β Standard Verification</strong> tab above.
|
| 137 |
-
</div>
|
| 138 |
-
""")
|
| 139 |
-
enhanced_verification_interface = create_enhanced_verification_tab()
|
| 140 |
-
|
| 141 |
-
# Edit Enhanced Datasets tab
|
| 142 |
-
with gr.TabItem("βοΈ Edit Enhanced Datasets", id="edit_datasets"):
|
| 143 |
-
from src.interface.dataset_editor_interface import create_dataset_editor_interface
|
| 144 |
-
dataset_editor_interface = create_dataset_editor_interface()
|
| 145 |
-
|
| 146 |
-
# Standard Verification Mode tab (conditionally shown based on feature flag)
|
| 147 |
-
if is_feature_enabled("standard_verification_enabled"):
|
| 148 |
-
with gr.TabItem("β Standard Verification", id="verification"):
|
| 149 |
-
# Verification mode state
|
| 150 |
-
verification_session = gr.State(value=None)
|
| 151 |
-
verification_store = gr.State(value=JSONVerificationStore())
|
| 152 |
-
|
| 153 |
-
# Navigation hint to enhanced verification (conditional)
|
| 154 |
-
if is_feature_enabled("show_mode_navigation_hints") and is_feature_enabled("enhanced_verification_enabled"):
|
| 155 |
-
with gr.Row():
|
| 156 |
-
gr.Markdown("""
|
| 157 |
-
<div style="padding: 0.75em; background-color: #f0fdf4; border-radius: 8px; border-left: 4px solid #22c55e; margin-bottom: 1em;">
|
| 158 |
-
<strong>π New!</strong> Try <strong>π Enhanced Verification</strong> for advanced features:
|
| 159 |
-
dataset editing, manual input testing, and batch file uploads.
|
| 160 |
-
</div>
|
| 161 |
-
""")
|
| 162 |
-
|
| 163 |
-
gr.Markdown("# β Verify Classifier Accuracy")
|
| 164 |
-
gr.Markdown("Review classified messages and provide feedback to improve the spiritual distress classifier.")
|
| 165 |
-
|
| 166 |
-
# Dataset selector section
|
| 167 |
-
with gr.Row():
|
| 168 |
-
with gr.Column(scale=2):
|
| 169 |
-
gr.Markdown("## π Select Dataset")
|
| 170 |
-
dataset_selector = VerificationUIComponents.create_dataset_selector_component()
|
| 171 |
-
load_dataset_btn = gr.Button("π₯ Load Dataset", variant="primary", scale=1)
|
| 172 |
-
|
| 173 |
-
with gr.Column(scale=1):
|
| 174 |
-
dataset_info = gr.Markdown(
|
| 175 |
-
value="Select a dataset to begin verification",
|
| 176 |
-
label="Dataset Info"
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
-
# Message review section - MUST be created outside with statement to control visibility
|
| 180 |
-
message_review_section = gr.Row(visible=False)
|
| 181 |
-
with message_review_section:
|
| 182 |
-
with gr.Column(scale=2):
|
| 183 |
-
# Progress display
|
| 184 |
-
progress_display = VerificationUIComponents.create_progress_display()
|
| 185 |
-
|
| 186 |
-
# Message review components
|
| 187 |
-
message_text, decision_badge, confidence, indicators = VerificationUIComponents.create_message_review_component()
|
| 188 |
-
|
| 189 |
-
# Feedback buttons
|
| 190 |
-
with gr.Row():
|
| 191 |
-
correct_btn, incorrect_btn = VerificationUIComponents.create_feedback_buttons()
|
| 192 |
-
|
| 193 |
-
# Correction selector (initially hidden)
|
| 194 |
-
correction_section = gr.Row(visible=False)
|
| 195 |
-
with correction_section:
|
| 196 |
-
correction_selector, notes_field = VerificationUIComponents.create_correction_selector()
|
| 197 |
-
|
| 198 |
-
# Submit correction button
|
| 199 |
-
submit_correction_row = gr.Row(visible=False)
|
| 200 |
-
with submit_correction_row:
|
| 201 |
-
submit_correction_btn = gr.Button("β Submit Correction", variant="primary", scale=2)
|
| 202 |
-
cancel_correction_btn = gr.Button("β Cancel", scale=1)
|
| 203 |
-
|
| 204 |
-
# Navigation buttons
|
| 205 |
-
with gr.Row():
|
| 206 |
-
prev_btn = gr.Button("β¬
οΈ Previous", scale=1)
|
| 207 |
-
skip_btn = gr.Button("βοΈ Skip", scale=1)
|
| 208 |
-
next_btn = gr.Button("Next β‘οΈ", scale=1)
|
| 209 |
-
|
| 210 |
-
# Save results button - using DownloadButton for Hugging Face compatibility
|
| 211 |
-
with gr.Row():
|
| 212 |
-
save_results_btn = gr.DownloadButton("πΎ Download Results (CSV)", variant="primary", scale=2)
|
| 213 |
-
clear_session_btn = gr.Button("ποΈ Clear Session", scale=1)
|
| 214 |
-
|
| 215 |
-
with gr.Column(scale=1):
|
| 216 |
-
# Statistics panel
|
| 217 |
-
correct_count_display, incorrect_count_display, accuracy_display = VerificationUIComponents.create_statistics_panel()
|
| 218 |
-
|
| 219 |
-
# Breakdown by type
|
| 220 |
-
breakdown_display = VerificationUIComponents.create_breakdown_by_type_component()
|
| 221 |
-
|
| 222 |
-
# Summary card
|
| 223 |
-
summary_card = VerificationUIComponents.create_summary_card_component()
|
| 224 |
-
|
| 225 |
-
# Chaplain Feedback Section - for displaying classification flows and collecting feedback
|
| 226 |
-
chaplain_feedback_section = gr.Row(visible=False)
|
| 227 |
-
with chaplain_feedback_section:
|
| 228 |
-
with gr.Column(scale=2):
|
| 229 |
-
# Classification flow display
|
| 230 |
-
flow_badge, flow_explanation, flow_content, flow_indicators = ChaplainFeedbackUIComponents.create_classification_flow_display()
|
| 231 |
-
|
| 232 |
-
# Tagging interface - returns individual components
|
| 233 |
-
(is_correct, subcategory, correct_classification,
|
| 234 |
-
question_issues, question_comments,
|
| 235 |
-
referral_issues, referral_comments,
|
| 236 |
-
indicator_issues, indicator_comments, general_notes) = ChaplainFeedbackUIComponents.create_tagging_interface()
|
| 237 |
-
|
| 238 |
-
# Submit feedback button
|
| 239 |
-
with gr.Row():
|
| 240 |
-
submit_feedback_btn = gr.Button("β Submit Feedback", variant="primary", scale=2)
|
| 241 |
-
skip_feedback_btn = gr.Button("βοΈ Skip Feedback", scale=1)
|
| 242 |
-
|
| 243 |
-
with gr.Column(scale=1):
|
| 244 |
-
# Error pattern summary
|
| 245 |
-
error_patterns, subcategory_breakdown, recommendations = ChaplainFeedbackUIComponents.create_error_pattern_summary()
|
| 246 |
-
|
| 247 |
-
# Results section
|
| 248 |
-
with gr.Row(visible=False) as results_section:
|
| 249 |
-
with gr.Column():
|
| 250 |
-
gr.Markdown("## π Verification Complete")
|
| 251 |
-
|
| 252 |
-
results_summary = gr.Markdown(
|
| 253 |
-
value="Session summary will appear here",
|
| 254 |
-
label="Results Summary"
|
| 255 |
-
)
|
| 256 |
-
|
| 257 |
-
with gr.Row():
|
| 258 |
-
download_csv_btn = gr.Button("π₯ Download Results (CSV)", variant="primary", scale=2)
|
| 259 |
-
new_dataset_btn = gr.Button("π Load Another Dataset", scale=1)
|
| 260 |
-
|
| 261 |
-
csv_download = gr.File(
|
| 262 |
-
label="CSV Download",
|
| 263 |
-
visible=False
|
| 264 |
-
)
|
| 265 |
-
|
| 266 |
-
# Error message display
|
| 267 |
-
error_message = gr.Markdown(
|
| 268 |
-
value="",
|
| 269 |
-
visible=True,
|
| 270 |
-
label="Status"
|
| 271 |
-
)
|
| 272 |
-
|
| 273 |
-
# Hidden state for tracking
|
| 274 |
-
current_message_index = gr.State(value=0)
|
| 275 |
-
current_dataset_id = gr.State(value=None)
|
| 276 |
-
message_queue = gr.State(value=[])
|
| 277 |
-
verification_records = gr.State(value=[])
|
| 278 |
|
| 279 |
# Chat tab
|
| 280 |
with gr.TabItem("π¬ Chat", id="chat"):
|
|
@@ -375,6 +228,11 @@ def create_simplified_interface():
|
|
| 375 |
conv_position = gr.Markdown(value="")
|
| 376 |
with gr.Column(scale=1):
|
| 377 |
conv_stats = gr.HTML(value="")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
|
| 379 |
# Model Selection tab (second tab)
|
| 380 |
with gr.TabItem("βοΈ Model Settings", id="model_settings"):
|
|
@@ -1554,8 +1412,10 @@ To revert, use "Reset to Default" button.
|
|
| 1554 |
print(f"CSV Export Error: {traceback.format_exc()}")
|
| 1555 |
return None
|
| 1556 |
|
| 1557 |
-
# Bind verification events (only if Standard Verification is enabled)
|
| 1558 |
-
|
|
|
|
|
|
|
| 1559 |
load_dataset_btn.click(
|
| 1560 |
load_verification_dataset,
|
| 1561 |
inputs=[dataset_selector, verification_store],
|
|
|
|
| 124 |
# Main interface - using Tabs with elem_id for navigation
|
| 125 |
main_tabs = gr.Tabs(elem_id="main_tabs")
|
| 126 |
with main_tabs:
|
| 127 |
+
# Note: The following tabs are intentionally hidden for now:
|
| 128 |
+
# - βοΈ Edit Enhanced Datasets
|
| 129 |
+
# - β Standard Verification
|
| 130 |
+
# We keep the rest of the interface focused on Chat + Conversation Verification.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
# Chat tab
|
| 133 |
with gr.TabItem("π¬ Chat", id="chat"):
|
|
|
|
| 228 |
conv_position = gr.Markdown(value="")
|
| 229 |
with gr.Column(scale=1):
|
| 230 |
conv_stats = gr.HTML(value="")
|
| 231 |
+
|
| 232 |
+
# Enhanced Verification Modes tab (hidden sub-tabs; kept but moved after Conversation Verification)
|
| 233 |
+
if is_feature_enabled("enhanced_verification_enabled"):
|
| 234 |
+
with gr.TabItem("π Enhanced Verification", id="enhanced_verification"):
|
| 235 |
+
enhanced_verification_interface = create_enhanced_verification_tab()
|
| 236 |
|
| 237 |
# Model Selection tab (second tab)
|
| 238 |
with gr.TabItem("βοΈ Model Settings", id="model_settings"):
|
|
|
|
| 1412 |
print(f"CSV Export Error: {traceback.format_exc()}")
|
| 1413 |
return None
|
| 1414 |
|
| 1415 |
+
# Bind verification events (only if Standard Verification UI is enabled).
|
| 1416 |
+
# The Standard Verification tab is currently hidden, so keep bindings disabled
|
| 1417 |
+
# to avoid referencing undefined components.
|
| 1418 |
+
if False and is_feature_enabled("standard_verification_enabled"):
|
| 1419 |
load_dataset_btn.click(
|
| 1420 |
load_verification_dataset,
|
| 1421 |
inputs=[dataset_selector, verification_store],
|