Spaces:
Sleeping
Sleeping
Hide dataset editor and standard verification tabs
Browse files123 unmodified lines12412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928094 unmodified lines3753763773783793801173 unmodified lines15541555155615571558155915601561123 unmodified lines# Main interface - using Tabs with elem_id for navigationmain_tabs = gr.Tabs(elem_id="main_tabs")with main_tabs:# Enhanced Verification Modes tab (conditionally shown based on feature flag)if is_feature_enabled("enhanced_verification_enabled"):with gr.TabItem("🔍 Enhanced Verification", id="enhanced_verification"):# Navigation hint to standard verification (conditional)if is_feature_enabled("show_mode_navigation_hints") and is_feature_enabled("standard_verification_enabled"):with gr.Row():gr.Markdown("""<div style="padding: 0.75em; background-color: #eff6ff; border-radius: 8px; border-left: 4px solid #3b82f6; margin-bottom: 1em;"><strong>💡 Tip:</strong> For quick dataset verification without editing capabilities, use the<strong>✓ Standard Verification</strong> tab above.</div>""")enhanced_verification_interface = create_enhanced_verification_tab()# Edit Enhanced Datasets tabwith gr.TabItem("✏️ Edit Enhanced Datasets", id="edit_datasets"):from src.interface.dataset_editor_interface import create_dataset_editor_interfacedataset_editor_interface = create_dataset_editor_interface()# Standard Verification Mode tab (conditionally shown based on feature flag)if is_feature_enabled("standard_verification_enabled"):with gr.TabItem("✓ Standard Verification", id="verification"):# Verification mode stateverification_session = gr.State(value=None)verification_store = gr.State(value=JSONVerificationStore())# Navigation hint to enhanced verification (conditional)if is_feature_enabled("show_mode_navigation_hints") and is_feature_enabled("enhanced_verification_enabled"):with gr.Row():gr.Markdown("""<div style="padding: 0.75em; background-color: #f0fdf4; border-radius: 8px; border-left: 4px solid #22c55e; margin-bottom: 1em;"><strong>🚀 New!</strong> Try <strong>🔍 Enhanced Verification</strong> for advanced features:dataset editing, manual input testing, and batch file uploads.</div>""")gr.Markdown("# ✓ Verify Classifier Accuracy")gr.Markdown("Review classified messages and provide feedback to improve the spiritual distress classifier.")# Dataset selector sectionwith gr.Row():with gr.Column(scale=2):gr.Markdown("## 📊 Select Dataset")dataset_selector = VerificationUIComponents.create_dataset_selector_component()load_dataset_btn = gr.Button("📥 Load Dataset", variant="primary", scale=1)with gr.Column(scale=1):dataset_info = gr.Markdown(value="Select a dataset to begin verification",label="Dataset Info")# Message review section - MUST be created outside with statement to control visibilitymessage_review_section = gr.Row(visible=False)with message_review_section:with gr.Column(scale=2):# Progress displayprogress_display = VerificationUIComponents.create_progress_display()# Message review componentsmessage_text, decision_badge, confidence, indicators = VerificationUIComponents.create_message_review_component()# Feedback buttonswith gr.Row():correct_btn, incorrect_btn = VerificationUIComponents.create_feedback_buttons()# Correction selector (initially hidden)correction_section = gr.Row(visible=False)with correction_section:correction_selector, notes_field = VerificationUIComponents.create_correction_selector()# Submit correction buttonsubmit_correction_row = gr.Row(visible=False)with submit_correction_row:submit_correction_btn = gr.Button("✓ Submit Correction", variant="primary", scale=2)cancel_correction_btn = gr.Button("✗ Cancel", scale=1)# Navigation buttonswith gr.Row():prev_btn = gr.Button("⬅️ Previous", scale=1)skip_btn = gr.Button("⏭️ Skip", scale=1)next_btn = gr.Button("Next ➡️", scale=1)# Save results button - using DownloadButton for Hugging Face compatibilitywith gr.Row():save_results_btn = gr.DownloadButton("💾 Download Results (CSV)", variant="primary", scale=2)clear_session_btn = gr.Button("🗑️ Clear Session", scale=1)with gr.Column(scale=1):# Statistics panelcorrect_count_display, incorrect_count_display, accuracy_display = VerificationUIComponents.create_statistics_panel()# Breakdown by typebreakdown_display = VerificationUIComponents.create_breakdown_by_type_component()# Summary cardsummary_card = VerificationUIComponents.create_summary_card_component()# Chaplain Feedback Section - for displaying classification flows and collecting feedbackchaplain_feedback_section = gr.Row(visible=False)with chaplain_feedback_section:with gr.Column(scale=2):# Classification flow displayflow_badge, flow_explanation, flow_content, flow_indicators = ChaplainFeedbackUIComponents.create_classification_flow_display()# Tagging interface - returns individual components(is_correct, subcategory, correct_classification,question_issues, question_comments,referral_issues, referral_comments,indicator_issues, indicator_comments, general_notes) = ChaplainFeedbackUIComponents.create_tagging_interface()# Submit feedback buttonwith gr.Row():submit_feedback_btn = gr.Button("✓ Submit Feedback", variant="primary", scale=2)skip_feedback_btn = gr.Button("⏭️ Skip Feedback", scale=1)with gr.Column(scale=1):# Error pattern summaryerror_patterns, subcategory_breakdown, recommendations = ChaplainFeedbackUIComponents.create_error_pattern_summary()# Results sectionwith gr.Row(visible=False) as results_section:with gr.Column():gr.Markdown("## 📊 Verification Complete")results_summary = gr.Markdown(value="Session summary will appear here",label="Results Summary")with gr.Row():download_csv_btn = gr.Button("📥 Download Results (CSV)", variant="primary", scale=2)new_dataset_btn = gr.Button("📊 Load Another Dataset", scale=1)csv_download = gr.File(label="CSV Download",visible=False)# Error message displayerror_message = gr.Markdown(value="",visible=True,label="Status")# Hidden state for trackingcurrent_message_index = gr.State(value=0)current_dataset_id = gr.State(value=None)message_queue = gr.State(value=[])verification_records = gr.State(value=[])# Chat tabwith gr.TabItem("💬 Chat", id="chat"):94 unmodified linesconv_position = gr.Markdown(value="")with gr.Column(scale=1):conv_stats = gr.HTML(value="")# Model Selection tab (second tab)with gr.TabItem("⚙️ Model Settings", id="model_settings"):1173 unmodified linesprint(f"CSV Export Error: {traceback.format_exc()}")return None# Bind verification events (only if Standard Verification is enabled)if is_feature_enabled("standard_verification_enabled"):load_dataset_btn.click(load_verification_dataset,inputs=[dataset_selector, verification_store],123 unmodified lines12412512612712812913013113213394 unmodified lines2282292302312322332342352362372381173 unmodified lines1412141314141415141614171418141914201421123 unmodified lines# Main interface - using Tabs with elem_id for navigationmain_tabs = gr.Tabs(elem_id="main_tabs")with main_tabs:# Note: The following tabs are intentionally hidden for now:# - ✏️ Edit Enhanced Datasets# - ✓ Standard Verification# We keep the rest of the interface focused on Chat + Conversation Verification.# Chat tabwith gr.TabItem("💬 Chat", id="chat"):94 unmodified linesconv_position = gr.Markdown(value="")with gr.Column(scale=1):conv_stats = gr.HTML(value="")# Enhanced Verification Modes tab (hidden sub-tabs; kept but moved after Conversation Verification)if is_feature_enabled("enhanced_verification_enabled"):with gr.TabItem("🔍 Enhanced Verification", id="enhanced_verification"):enhanced_verification_interface = create_enhanced_verification_tab()# Model Selection tab (second tab)with gr.TabItem("⚙️ Model Settings", id="model_settings"):1173 unmodified linesprint(f"CSV Export Error: {traceback.format_exc()}")return None# Bind verification events (only if Standard Verification UI is enabled).# The Standard Verification tab is currently hidden, so keep bindings disabled# to avoid referencing undefined components.if False and is_feature_enabled("standard_verification_enabled"):load_dataset_btn.click(load_verification_dataset,inputs=[dataset_selector, verification_store],
src/interface/simplified_gradio_app.py+13-153