Spaces:
Sleeping
Sleeping
All updates overhaul
Browse files
app.py
CHANGED
@@ -188,9 +188,9 @@ def generateSentences(gr1, gr2, att1, att2, openai_key, num_sent2gen, progress=g
|
|
188 |
print(f"Online gen visible: {not err_update['visible']}")
|
189 |
return (err_update, # err message if any
|
190 |
info_msg_update, # infor message about the number of sentences and coverage
|
191 |
-
gr.Row
|
192 |
#gr.Slider.update(minimum=8, maximum=24, value=4), # slider generation
|
193 |
-
gr.Row
|
194 |
#gr.Dropdown.update(visible=test_model_visible), # tested model selection dropdown
|
195 |
gr.Accordion(visible=test_model_visible, label=f"Test sentences ({len(G_TEST_SENTENCES)})"), # update
|
196 |
gr.update(visible=True), # Row sentences
|
@@ -224,10 +224,10 @@ def moveStep1_clear():
|
|
224 |
gr.update(visible=tabs[0]),
|
225 |
gr.update(visible=tabs[1]),
|
226 |
gr.update(visible=tabs[2]),
|
227 |
-
gr.Textbox
|
228 |
-
gr.Textbox
|
229 |
-
gr.Textbox
|
230 |
-
gr.Textbox
|
231 |
|
232 |
def moveStep2():
|
233 |
variants = ["secondary","primary","secondary"]
|
@@ -311,9 +311,9 @@ def retrieveSentences(gr1, gr2, att1, att2, progress=gr.Progress()):
|
|
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
|
315 |
tested_model_dropdown_update = gr.Dropdown(visible=False) #update
|
316 |
-
tested_model_row_update = gr.Row
|
317 |
# additinal sentences disabled by default
|
318 |
gen_additional_sentence_checkbox_update = gr.Checkbox(visible=False) #update
|
319 |
|
@@ -382,9 +382,9 @@ def retrieveSentences(gr1, gr2, att1, att2, progress=gr.Progress()):
|
|
382 |
print(f"Got {len(test_sentences)}, allowing bias test...")
|
383 |
#print(test_sentences)
|
384 |
bias_gen_states = [False, True]
|
385 |
-
openai_gen_row_update = gr.Row
|
386 |
tested_model_dropdown_update = gr.Dropdown(visible=True) #update
|
387 |
-
tested_model_row_update = gr.Row
|
388 |
|
389 |
# still give the option to generate more sentences
|
390 |
gen_additional_sentence_checkbox_update = gr.Checkbox(visible=True) #update
|
@@ -393,7 +393,7 @@ def retrieveSentences(gr1, gr2, att1, att2, progress=gr.Progress()):
|
|
393 |
bias_test_label = "Test Model Using Imbalanced Sentences"
|
394 |
bias_gen_states = [True, True]
|
395 |
tested_model_dropdown_update = gr.Dropdown(visible=True) #update
|
396 |
-
tested_model_row_update = gr.Row
|
397 |
|
398 |
return (err_update, # error message
|
399 |
openai_gen_row_update, # OpenAI generation
|
@@ -674,25 +674,25 @@ def export_csv(test_pairs, gr1, gr2, att1, att2):
|
|
674 |
fname = f"test_pairs_{b_name}.csv"
|
675 |
|
676 |
test_pairs.to_csv(fname)
|
677 |
-
return gr.File
|
678 |
|
679 |
# Enable Generation of new sentences, even though not required.
|
680 |
def useOnlineGen(value):
|
681 |
-
online_gen_row_update = gr.Row
|
682 |
-
num_sentences2gen_update = gr.Slider
|
683 |
gen_btn_update = gr.Button(visible=False) #update
|
684 |
|
685 |
gen_title_update = gr.Markdown(visible=False) #update
|
686 |
-
openai_key_update = gr.Textbox
|
687 |
|
688 |
if value == True:
|
689 |
print("Check is true...")
|
690 |
-
online_gen_row_update = gr.Row
|
691 |
-
num_sentences2gen_update = gr.Slider
|
692 |
gen_btn_update = gr.Button(visible=True, value="Generate Additional Sentences") #update
|
693 |
|
694 |
gen_title_update = gr.Markdown(visible=True) # update
|
695 |
-
openai_key_update = gr.Textbox
|
696 |
else:
|
697 |
print("Check is false...")
|
698 |
|
|
|
188 |
print(f"Online gen visible: {not err_update['visible']}")
|
189 |
return (err_update, # err message if any
|
190 |
info_msg_update, # infor message about the number of sentences and coverage
|
191 |
+
gr.Row(visible=online_gen_visible), #update # online gen row
|
192 |
#gr.Slider.update(minimum=8, maximum=24, value=4), # slider generation
|
193 |
+
gr.Row(visible=test_model_visible), #update # tested model row
|
194 |
#gr.Dropdown.update(visible=test_model_visible), # tested model selection dropdown
|
195 |
gr.Accordion(visible=test_model_visible, label=f"Test sentences ({len(G_TEST_SENTENCES)})"), # update
|
196 |
gr.update(visible=True), # Row sentences
|
|
|
224 |
gr.update(visible=tabs[0]),
|
225 |
gr.update(visible=tabs[1]),
|
226 |
gr.update(visible=tabs[2]),
|
227 |
+
gr.Textbox(value=""), #update
|
228 |
+
gr.Textbox(value=""), #update
|
229 |
+
gr.Textbox(value=""), #update
|
230 |
+
gr.Textbox(value="")) #update
|
231 |
|
232 |
def moveStep2():
|
233 |
variants = ["secondary","primary","secondary"]
|
|
|
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(visible=True) #update
|
315 |
tested_model_dropdown_update = gr.Dropdown(visible=False) #update
|
316 |
+
tested_model_row_update = gr.Row(visible=False) #update
|
317 |
# additinal sentences disabled by default
|
318 |
gen_additional_sentence_checkbox_update = gr.Checkbox(visible=False) #update
|
319 |
|
|
|
382 |
print(f"Got {len(test_sentences)}, allowing bias test...")
|
383 |
#print(test_sentences)
|
384 |
bias_gen_states = [False, True]
|
385 |
+
openai_gen_row_update = gr.Row(visible=False) #update
|
386 |
tested_model_dropdown_update = gr.Dropdown(visible=True) #update
|
387 |
+
tested_model_row_update = gr.Row(visible=True) #update
|
388 |
|
389 |
# still give the option to generate more sentences
|
390 |
gen_additional_sentence_checkbox_update = gr.Checkbox(visible=True) #update
|
|
|
393 |
bias_test_label = "Test Model Using Imbalanced Sentences"
|
394 |
bias_gen_states = [True, True]
|
395 |
tested_model_dropdown_update = gr.Dropdown(visible=True) #update
|
396 |
+
tested_model_row_update = gr.Row(visible=True) #update
|
397 |
|
398 |
return (err_update, # error message
|
399 |
openai_gen_row_update, # OpenAI generation
|
|
|
674 |
fname = f"test_pairs_{b_name}.csv"
|
675 |
|
676 |
test_pairs.to_csv(fname)
|
677 |
+
return gr.File(value=fname, visible=True) #update
|
678 |
|
679 |
# Enable Generation of new sentences, even though not required.
|
680 |
def useOnlineGen(value):
|
681 |
+
online_gen_row_update = gr.Row(visible=False) #update
|
682 |
+
num_sentences2gen_update = gr.Slider(visible=False) #update
|
683 |
gen_btn_update = gr.Button(visible=False) #update
|
684 |
|
685 |
gen_title_update = gr.Markdown(visible=False) #update
|
686 |
+
openai_key_update = gr.Textbox(visible=False) #update
|
687 |
|
688 |
if value == True:
|
689 |
print("Check is true...")
|
690 |
+
online_gen_row_update = gr.Row(visible=True) #update
|
691 |
+
num_sentences2gen_update = gr.Slider(visible=True) #update
|
692 |
gen_btn_update = gr.Button(visible=True, value="Generate Additional Sentences") #update
|
693 |
|
694 |
gen_title_update = gr.Markdown(visible=True) # update
|
695 |
+
openai_key_update = gr.Textbox(visible=True) #update
|
696 |
else:
|
697 |
print("Check is false...")
|
698 |
|