Create Bare Interface
Browse files
app.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def run_evaluation(dataset_id, methodology):
|
| 4 |
+
return f'Running evaluation for {dataset_id} with {methodology}'
|
| 5 |
+
|
| 6 |
+
if methodology == 'A':
|
| 7 |
+
run_a(dataset_id)
|
| 8 |
+
elif methodology == 'B':
|
| 9 |
+
run_b(dataset_id)
|
| 10 |
+
elif methodology == 'C':
|
| 11 |
+
run_c(dataset_id)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
demo = gr.Blocks(theme=gr.themes.Soft())
|
| 15 |
+
|
| 16 |
+
with demo:
|
| 17 |
+
gr.Markdown("# BiasAware: Dataset Bias Detection")
|
| 18 |
+
|
| 19 |
+
with gr.Row():
|
| 20 |
+
with gr.Column(scale=1):
|
| 21 |
+
gr.Markdown("Select a dataset to analyze")
|
| 22 |
+
|
| 23 |
+
dataset_id = gr.Text(label="Dataset")
|
| 24 |
+
gr.Examples(
|
| 25 |
+
examples=["imdb", "amazon_reviews_multi", "tweet_eval"],
|
| 26 |
+
fn=run_evaluation,
|
| 27 |
+
inputs=[dataset_id]
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
methodology = gr.Dropdown(["Term Identity Diversity Analysis", "Textual Gender Label Evaluation", "GenBit"], label="Methodology")
|
| 31 |
+
|
| 32 |
+
button = gr.Button("Run Evaluation")
|
| 33 |
+
|
| 34 |
+
with gr.Column(scale=4):
|
| 35 |
+
gr.Markdown("### Results")
|
| 36 |
+
|
| 37 |
+
with gr.Box():
|
| 38 |
+
methodology_title = gr.Markdown("### Identity Term Sampling")
|
| 39 |
+
methodology_description = gr.Markdown("lorem ipsum")
|
| 40 |
+
|
| 41 |
+
methodology_test_description = gr.Markdown("lorem ipsum")
|
| 42 |
+
outputs = gr.Markdown()
|
| 43 |
+
gr.Error("No results to display")
|
| 44 |
+
|
| 45 |
+
methodology.change(
|
| 46 |
+
fn=lambda x: (f'### {x}', "lorem ipseum", "lorem ipsum"),
|
| 47 |
+
inputs=[methodology],
|
| 48 |
+
outputs=[methodology_title, methodology_description, methodology_test_description]
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
button.click(
|
| 52 |
+
fn=run_evaluation,
|
| 53 |
+
inputs=[dataset_id, methodology],
|
| 54 |
+
outputs=[outputs]
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
demo.launch()
|