import gradio as gr def run_evaluation(dataset_id, methodology): return f'Running evaluation for {dataset_id} with {methodology}' if methodology == 'A': run_a(dataset_id) elif methodology == 'B': run_b(dataset_id) elif methodology == 'C': run_c(dataset_id) def schema_uploaded_file(file): file_paths = [file.name for file in file] return file_paths demo = gr.Blocks(theme=gr.themes.Soft()) with demo: gr.Markdown("# BiasAware: Dataset Bias Detection") with gr.Row(): with gr.Column(scale=1): gr.Markdown("Select a dataset to analyze") dataset_id = gr.Text(label="Dataset") gr.Examples( examples=["imdb", "amazon_reviews_multi", "tweet_eval"], fn=run_evaluation, inputs=[dataset_id] ) methodology = gr.Dropdown(["Term Identity Diversity Analysis", "Textual Gender Label Evaluation", "GenBit"], label="Methodology") button = gr.Button("Run Evaluation") with gr.Column(scale=4): gr.Markdown("### Results") with gr.Box(): methodology_title = gr.Markdown("### Identity Term Sampling") methodology_description = gr.Markdown("lorem ipsum") methodology_test_description = gr.Markdown("lorem ipsum") outputs = gr.Markdown() gr.Error("No results to display") methodology.change( fn=lambda x: (f'### {x}', "lorem ipseum", "lorem ipsum"), inputs=[methodology], outputs=[methodology_title, methodology_description, methodology_test_description] ) button.click( fn=run_evaluation, inputs=[dataset_id, methodology], outputs=[outputs] ) # For user dataset upload gr.Interface(schema_uploaded_file, "file", "text") demo.launch()