Spaces:
Sleeping
Sleeping
Ryan
commited on
Commit
·
d143368
1
Parent(s):
6655d5a
update
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from ui.dataset_input import create_dataset_input, load_example_dataset
|
3 |
from ui.analysis_screen import create_analysis_screen
|
4 |
from visualization.bow_visualizer import process_and_visualize_analysis
|
|
|
5 |
import nltk
|
6 |
import os
|
7 |
import logging
|
@@ -502,6 +503,29 @@ def create_app():
|
|
502 |
for category, diff in differences.items()
|
503 |
])
|
504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
# If we don't have visualization data from any analysis
|
506 |
if not visualization_area_visible:
|
507 |
return (
|
|
|
2 |
from ui.dataset_input import create_dataset_input, load_example_dataset
|
3 |
from ui.analysis_screen import create_analysis_screen
|
4 |
from visualization.bow_visualizer import process_and_visualize_analysis
|
5 |
+
from visualization.bias_visualizer import process_and_visualize_bias_analysis
|
6 |
import nltk
|
7 |
import os
|
8 |
import logging
|
|
|
503 |
for category, diff in differences.items()
|
504 |
])
|
505 |
|
506 |
+
# Add visualization handling for Bias Detection
|
507 |
+
elif selected_analysis == "Bias Detection" and "bias_detection" in analyses:
|
508 |
+
# Use the bias visualization function to create components
|
509 |
+
visualization_components = process_and_visualize_bias_analysis(analysis_results)
|
510 |
+
|
511 |
+
# Set up visibility and components for display
|
512 |
+
return (
|
513 |
+
analysis_results, # analysis_results_state
|
514 |
+
False, # analysis_output visibility
|
515 |
+
True, # visualization_area_visible
|
516 |
+
gr.update(visible=True), # analysis_title
|
517 |
+
gr.update(visible=True, value=f"## Analysis of Prompt: \"{prompt[:100]}...\""), # prompt_title
|
518 |
+
gr.update(visible=True, value=f"### Comparing responses from {models[0]} and {models[1]}"), # models_compared
|
519 |
+
gr.update(visible=False), # model1_title
|
520 |
+
gr.update(visible=False), # model1_words
|
521 |
+
gr.update(visible=False), # model2_title
|
522 |
+
gr.update(visible=False), # model2_words
|
523 |
+
gr.update(visible=False), # similarity_metrics_title
|
524 |
+
gr.update(visible=False), # similarity_metrics
|
525 |
+
False, # status_message_visible
|
526 |
+
gr.update(visible=False) # status_message
|
527 |
+
)
|
528 |
+
|
529 |
# If we don't have visualization data from any analysis
|
530 |
if not visualization_area_visible:
|
531 |
return (
|