Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,11 @@ def calculate_accuracy(flood_selections, fire_selections, none_selections, num_p
|
|
| 53 |
incorrect = len(selections)
|
| 54 |
correct = num_posts - incorrect
|
| 55 |
accuracy = (correct/num_posts)*100
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
|
|
@@ -119,6 +123,7 @@ with gr.Blocks() as demo:
|
|
| 119 |
accuracy = gr.Number(label="Model Accuracy (%)")
|
| 120 |
|
| 121 |
accuracy_button = gr.Button("Calculate Accuracy")
|
|
|
|
| 122 |
num_posts = gr.Number(visible=False)
|
| 123 |
data = gr.DataFrame(visible=False)
|
| 124 |
data_eval = gr.DataFrame()
|
|
@@ -129,7 +134,7 @@ with gr.Blocks() as demo:
|
|
| 129 |
outputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, model_confidence, num_posts, data])
|
| 130 |
accuracy_button.click(
|
| 131 |
calculate_accuracy,
|
| 132 |
-
inputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, num_posts, text_field, data],
|
| 133 |
outputs=[incorrect, correct, accuracy, data_eval])
|
| 134 |
|
| 135 |
with gr.Tab("Question Answering"):
|
|
|
|
| 53 |
incorrect = len(selections)
|
| 54 |
correct = num_posts - incorrect
|
| 55 |
accuracy = (correct/num_posts)*100
|
| 56 |
+
|
| 57 |
+
file_path = "/tmp/results.csv"
|
| 58 |
+
data_df.to_csv(file_path, index=False)
|
| 59 |
+
|
| 60 |
+
return incorrect, correct, accuracy, data_df, gr.File.update(value="output.csv", visible=True)
|
| 61 |
|
| 62 |
|
| 63 |
|
|
|
|
| 123 |
accuracy = gr.Number(label="Model Accuracy (%)")
|
| 124 |
|
| 125 |
accuracy_button = gr.Button("Calculate Accuracy")
|
| 126 |
+
csv = gr.File(interactive=False, visible=False)
|
| 127 |
num_posts = gr.Number(visible=False)
|
| 128 |
data = gr.DataFrame(visible=False)
|
| 129 |
data_eval = gr.DataFrame()
|
|
|
|
| 134 |
outputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, model_confidence, num_posts, data])
|
| 135 |
accuracy_button.click(
|
| 136 |
calculate_accuracy,
|
| 137 |
+
inputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, num_posts, text_field, data, csv],
|
| 138 |
outputs=[incorrect, correct, accuracy, data_eval])
|
| 139 |
|
| 140 |
with gr.Tab("Question Answering"):
|