fix caching
Browse files
app.py
CHANGED
@@ -19,6 +19,16 @@ num_predictions_model = 0
|
|
19 |
model_accuracy = -1
|
20 |
human_accuracy = 0
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def show_entry_and_calculate_accuracy(hidden_box, *args):
|
23 |
global current_index, num_predictions_human, num_predictions_model, model_accuracy, human_accuracy
|
24 |
entry = filtered_data[current_index]
|
@@ -171,11 +181,12 @@ with gr.Blocks() as demo:
|
|
171 |
[Papers With Code](https://paperswithcode.com/paper/a-synthetic-dataset-for-personal-attribute)<br/>
|
172 |
</p></span>
|
173 |
""")
|
174 |
-
|
175 |
def hello_world():
|
176 |
gr.Info("Hi! This space was created by authors of the dataset SynthPAI. Click the button 'Submit' to start.")
|
177 |
return "hello world"
|
178 |
|
179 |
-
demo.load(hello_world)
|
|
|
180 |
|
181 |
demo.queue().launch()
|
|
|
19 |
model_accuracy = -1
|
20 |
human_accuracy = 0
|
21 |
|
22 |
+
def cleanup (req: gr.Request):
|
23 |
+
global current_index, num_predictions_human, num_predictions_model, model_accuracy, human_accuracy
|
24 |
+
current_index = 0
|
25 |
+
num_predictions_human = 0
|
26 |
+
num_predictions_model = 0
|
27 |
+
model_accuracy = -1
|
28 |
+
human_accuracy = 0
|
29 |
+
total_acc_human = 0
|
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]
|
|
|
181 |
[Papers With Code](https://paperswithcode.com/paper/a-synthetic-dataset-for-personal-attribute)<br/>
|
182 |
</p></span>
|
183 |
""")
|
184 |
+
|
185 |
def hello_world():
|
186 |
gr.Info("Hi! This space was created by authors of the dataset SynthPAI. Click the button 'Submit' to start.")
|
187 |
return "hello world"
|
188 |
|
189 |
+
demo.load(hello_world)
|
190 |
+
demo.unload(cleanup)
|
191 |
|
192 |
demo.queue().launch()
|