Spaces:
Runtime error
Runtime error
enabled live drawing and prediction
Browse files
app.py
CHANGED
@@ -444,9 +444,6 @@ def main():
|
|
444 |
|
445 |
image_input =gr.inputs.Image(source="canvas",shape=(28,28),invert_colors=True,image_mode="L",type="pil")
|
446 |
label_output = gr.outputs.Label(num_top_classes=2)
|
447 |
-
|
448 |
-
|
449 |
-
submit = gr.Button("Submit")
|
450 |
|
451 |
gr.Markdown(MODEL_IS_WRONG)
|
452 |
|
@@ -459,7 +456,7 @@ def main():
|
|
459 |
adversarial_number = gr.Variable(value=0)
|
460 |
|
461 |
|
462 |
-
|
463 |
flag_btn.click(flag,inputs=[image_input,number_dropdown,adversarial_number],outputs=[output_result,adversarial_number])
|
464 |
|
465 |
with gr.TabItem('Dashboard') as dashboard:
|
|
|
444 |
|
445 |
image_input =gr.inputs.Image(source="canvas",shape=(28,28),invert_colors=True,image_mode="L",type="pil")
|
446 |
label_output = gr.outputs.Label(num_top_classes=2)
|
|
|
|
|
|
|
447 |
|
448 |
gr.Markdown(MODEL_IS_WRONG)
|
449 |
|
|
|
456 |
adversarial_number = gr.Variable(value=0)
|
457 |
|
458 |
|
459 |
+
image_input.change(image_classifier,inputs = [image_input],outputs=[label_output])
|
460 |
flag_btn.click(flag,inputs=[image_input,number_dropdown,adversarial_number],outputs=[output_result,adversarial_number])
|
461 |
|
462 |
with gr.TabItem('Dashboard') as dashboard:
|
utils.py
CHANGED
@@ -12,11 +12,10 @@ This kind of data is presumably the most valuable for a model, so this can be he
|
|
12 |
"""
|
13 |
WHAT_TO_DO="""
|
14 |
### What to do:
|
15 |
-
1. Draw any number from 0-9.
|
16 |
-
2.
|
17 |
-
3.
|
18 |
-
4.
|
19 |
-
5. The model will finetune on the adversarial samples after every __{num_samples}__ samples have been generated.
|
20 |
"""
|
21 |
|
22 |
MODEL_IS_WRONG = """
|
|
|
12 |
"""
|
13 |
WHAT_TO_DO="""
|
14 |
### What to do:
|
15 |
+
1. Draw any number from 0-9. The model will automatically try to predict it after drawing.
|
16 |
+
2. If the model misclassifies it, Flag that example.
|
17 |
+
3. This will add your (adversarial) example to a dataset on which the model will be trained later.
|
18 |
+
4. The model will finetune on the adversarial samples after every __{num_samples}__ samples have been generated.
|
|
|
19 |
"""
|
20 |
|
21 |
MODEL_IS_WRONG = """
|