Spaces:
Sleeping
Sleeping
Removed update completely, directly return updated component
Browse files
app.py
CHANGED
|
@@ -82,7 +82,7 @@ def prefillBiasSpec(evt: gr.SelectData):
|
|
| 82 |
gr.update(interactive=False, visible=False))
|
| 83 |
|
| 84 |
def updateErrorMsg(isError, text):
|
| 85 |
-
return gr.Markdown
|
| 86 |
|
| 87 |
def countBiasCustomSpec(bias_spec):
|
| 88 |
if (bias_spec) == 0:
|
|
@@ -180,7 +180,7 @@ def generateSentences(gr1, gr2, att1, att2, openai_key, num_sent2gen, progress=g
|
|
| 180 |
test_model_visible = True # show choise of tested model and the sentences
|
| 181 |
info_msg, att1_missing, att2_missing, total_missing, c_bias_spec = _genSentenceCoverMsg(G_TEST_SENTENCES, total_att_terms, bias_spec, isGen=True)
|
| 182 |
|
| 183 |
-
info_msg_update = gr.Markdown
|
| 184 |
bias_test_label = "Test Model For Social Bias"
|
| 185 |
|
| 186 |
#cookie_mgr.saveOpenAIKey(openai_key)
|
|
@@ -310,7 +310,7 @@ def retrieveSentences(gr1, gr2, att1, att2, progress=gr.Progress()):
|
|
| 310 |
num2gen_update = gr.update(visible=True) #update the number of new sentences to generate
|
| 311 |
prog_vis = [True]
|
| 312 |
err_update = updateErrorMsg(False, "")
|
| 313 |
-
info_msg_update = gr.Markdown
|
| 314 |
openai_gen_row_update = gr.Row.update(visible=True)
|
| 315 |
tested_model_dropdown_update = gr.Dropdown.update(visible=False)
|
| 316 |
tested_model_row_update = gr.Row.update(visible=False)
|
|
@@ -374,7 +374,7 @@ def retrieveSentences(gr1, gr2, att1, att2, progress=gr.Progress()):
|
|
| 374 |
G_MISSING_SPEC = c_bias_spec
|
| 375 |
print(f"Saving global custom bias specification: {G_MISSING_SPEC}")
|
| 376 |
|
| 377 |
-
info_msg_update = gr.Markdown
|
| 378 |
num2gen_update = gr.update(visible=False)
|
| 379 |
bias_gen_label = f"Generate Additional {total_missing} Sentences"
|
| 380 |
|
|
@@ -608,7 +608,7 @@ def startBiasTest(test_sentences_df, gr1, gr2, att1, att2, model_name, progress=
|
|
| 608 |
saveBiasTestResult(test_sentences_df, gr1, gr2, att1, att2, model_name)
|
| 609 |
|
| 610 |
return (err_update, # error message
|
| 611 |
-
gr.Markdown
|
| 612 |
gr.Button.update(variant=variants[0], interactive=inter[0]), # top breadcrumb button 1
|
| 613 |
gr.Button.update(variant=variants[1], interactive=inter[1]), # top breadcrumb button 2
|
| 614 |
gr.Button.update(variant=variants[2], interactive=inter[2]), # top breadcrumb button 3
|
|
@@ -682,7 +682,7 @@ def useOnlineGen(value):
|
|
| 682 |
num_sentences2gen_update = gr.Slider.update(visible=False)
|
| 683 |
gen_btn_update = gr.Button.update(visible=False)
|
| 684 |
|
| 685 |
-
gen_title_update = gr.Markdown
|
| 686 |
openai_key_update = gr.Textbox.update(visible=False)
|
| 687 |
|
| 688 |
if value == True:
|
|
@@ -691,7 +691,7 @@ def useOnlineGen(value):
|
|
| 691 |
num_sentences2gen_update = gr.Slider.update(visible=True)
|
| 692 |
gen_btn_update = gr.Button.update(visible=True, value="Generate Additional Sentences")
|
| 693 |
|
| 694 |
-
gen_title_update = gr.Markdown
|
| 695 |
openai_key_update = gr.Textbox.update(visible=True)
|
| 696 |
else:
|
| 697 |
print("Check is false...")
|
|
|
|
| 82 |
gr.update(interactive=False, visible=False))
|
| 83 |
|
| 84 |
def updateErrorMsg(isError, text):
|
| 85 |
+
return gr.Markdown(visible=isError, value=text) #update
|
| 86 |
|
| 87 |
def countBiasCustomSpec(bias_spec):
|
| 88 |
if (bias_spec) == 0:
|
|
|
|
| 180 |
test_model_visible = True # show choise of tested model and the sentences
|
| 181 |
info_msg, att1_missing, att2_missing, total_missing, c_bias_spec = _genSentenceCoverMsg(G_TEST_SENTENCES, total_att_terms, bias_spec, isGen=True)
|
| 182 |
|
| 183 |
+
info_msg_update = gr.Markdown(visible=True, value=info_msg) #update
|
| 184 |
bias_test_label = "Test Model For Social Bias"
|
| 185 |
|
| 186 |
#cookie_mgr.saveOpenAIKey(openai_key)
|
|
|
|
| 310 |
num2gen_update = gr.update(visible=True) #update the number of new sentences to generate
|
| 311 |
prog_vis = [True]
|
| 312 |
err_update = updateErrorMsg(False, "")
|
| 313 |
+
info_msg_update = gr.Markdown(visible=False, value="") #update
|
| 314 |
openai_gen_row_update = gr.Row.update(visible=True)
|
| 315 |
tested_model_dropdown_update = gr.Dropdown.update(visible=False)
|
| 316 |
tested_model_row_update = gr.Row.update(visible=False)
|
|
|
|
| 374 |
G_MISSING_SPEC = c_bias_spec
|
| 375 |
print(f"Saving global custom bias specification: {G_MISSING_SPEC}")
|
| 376 |
|
| 377 |
+
info_msg_update = gr.Markdown(visible=True, value=info_msg) #update
|
| 378 |
num2gen_update = gr.update(visible=False)
|
| 379 |
bias_gen_label = f"Generate Additional {total_missing} Sentences"
|
| 380 |
|
|
|
|
| 608 |
saveBiasTestResult(test_sentences_df, gr1, gr2, att1, att2, model_name)
|
| 609 |
|
| 610 |
return (err_update, # error message
|
| 611 |
+
gr.Markdown(visible=True), # update # bar progress
|
| 612 |
gr.Button.update(variant=variants[0], interactive=inter[0]), # top breadcrumb button 1
|
| 613 |
gr.Button.update(variant=variants[1], interactive=inter[1]), # top breadcrumb button 2
|
| 614 |
gr.Button.update(variant=variants[2], interactive=inter[2]), # top breadcrumb button 3
|
|
|
|
| 682 |
num_sentences2gen_update = gr.Slider.update(visible=False)
|
| 683 |
gen_btn_update = gr.Button.update(visible=False)
|
| 684 |
|
| 685 |
+
gen_title_update = gr.Markdown(visible=False) #update
|
| 686 |
openai_key_update = gr.Textbox.update(visible=False)
|
| 687 |
|
| 688 |
if value == True:
|
|
|
|
| 691 |
num_sentences2gen_update = gr.Slider.update(visible=True)
|
| 692 |
gen_btn_update = gr.Button.update(visible=True, value="Generate Additional Sentences")
|
| 693 |
|
| 694 |
+
gen_title_update = gr.Markdown(visible=True) # update
|
| 695 |
openai_key_update = gr.Textbox.update(visible=True)
|
| 696 |
else:
|
| 697 |
print("Check is false...")
|