hannayukhymenko
commited on
Commit
•
83ace66
1
Parent(s):
28f601a
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,8 @@ def cleanup (req: gr.Request):
|
|
30 |
total_acc_model = 0
|
31 |
|
32 |
def show_entry_and_calculate_accuracy(hidden_box, *args):
|
33 |
-
global current_index, num_predictions_human, num_predictions_model, model_accuracy, human_accuracy
|
|
|
34 |
entry = filtered_data[current_index]
|
35 |
user_predictions = {}
|
36 |
for i, attr in enumerate(feature_names):
|
@@ -74,7 +75,7 @@ def show_entry_and_calculate_accuracy(hidden_box, *args):
|
|
74 |
else:
|
75 |
total_acc_model = round(model_accuracy / num_predictions_model, 2) * 100
|
76 |
accuracy = 'Number of correct guesses made by you: ' + str(human_accuracy) + '\nYour accuracy ' + str(total_acc_human) + '%\n' + 'Number of correct guesses made by LLM: ' + str(model_accuracy)+ '\nModel accuracy ' + str(total_acc_model) + '%'
|
77 |
-
return accuracy, hidden_box, name
|
78 |
|
79 |
with gr.Blocks() as demo:
|
80 |
with gr.Column():
|
@@ -167,7 +168,7 @@ with gr.Blocks() as demo:
|
|
167 |
|
168 |
with gr.Row(equal_height=True):
|
169 |
btn = gr.Button("Submit")
|
170 |
-
btn.click(fn=show_entry_and_calculate_accuracy, inputs=[hidden_box, *inputs], outputs=[accuracy, hidden_box, name])
|
171 |
with gr.Row(equal_height=True):
|
172 |
gr.Markdown(
|
173 |
"""
|
|
|
30 |
total_acc_model = 0
|
31 |
|
32 |
def show_entry_and_calculate_accuracy(hidden_box, *args):
|
33 |
+
global current_index, num_predictions_human, num_predictions_model, model_accuracy, human_accuracy
|
34 |
+
pre_filled_values = [""] * len(feature_names)
|
35 |
entry = filtered_data[current_index]
|
36 |
user_predictions = {}
|
37 |
for i, attr in enumerate(feature_names):
|
|
|
75 |
else:
|
76 |
total_acc_model = round(model_accuracy / num_predictions_model, 2) * 100
|
77 |
accuracy = 'Number of correct guesses made by you: ' + str(human_accuracy) + '\nYour accuracy ' + str(total_acc_human) + '%\n' + 'Number of correct guesses made by LLM: ' + str(model_accuracy)+ '\nModel accuracy ' + str(total_acc_model) + '%'
|
78 |
+
return accuracy, hidden_box, name, *pre_filled_values
|
79 |
|
80 |
with gr.Blocks() as demo:
|
81 |
with gr.Column():
|
|
|
168 |
|
169 |
with gr.Row(equal_height=True):
|
170 |
btn = gr.Button("Submit")
|
171 |
+
btn.click(fn=show_entry_and_calculate_accuracy, inputs=[hidden_box, *inputs], outputs=[accuracy, hidden_box, name, *inputs])
|
172 |
with gr.Row(equal_height=True):
|
173 |
gr.Markdown(
|
174 |
"""
|