Add flagging arguments
Browse files
app.py
CHANGED
@@ -70,7 +70,7 @@ def predict_fn(input_img):
|
|
70 |
)
|
71 |
logger.info(f"probabilities: {probabilities}")
|
72 |
decision_json = json.dumps(
|
73 |
-
{"is_base_body": float(probabilities[0][1])}
|
74 |
).encode("utf-8")
|
75 |
logger.info(f"decision_json: {decision_json}")
|
76 |
return decision_json
|
@@ -81,6 +81,11 @@ iface = gr.Interface(
|
|
81 |
inputs="image",
|
82 |
outputs="text",
|
83 |
allow_flagging="manual",
|
|
|
|
|
|
|
|
|
|
|
84 |
flagging_callback=hf_writer
|
85 |
)
|
86 |
iface.launch()
|
|
|
70 |
)
|
71 |
logger.info(f"probabilities: {probabilities}")
|
72 |
decision_json = json.dumps(
|
73 |
+
{"is_base_body": float(probabilities[0][1].round(3))}
|
74 |
).encode("utf-8")
|
75 |
logger.info(f"decision_json: {decision_json}")
|
76 |
return decision_json
|
|
|
81 |
inputs="image",
|
82 |
outputs="text",
|
83 |
allow_flagging="manual",
|
84 |
+
flagging_options=[
|
85 |
+
"probability error > 0.5",
|
86 |
+
"0.2 < probability error < 0.5",
|
87 |
+
"probability error < 0.2"
|
88 |
+
],
|
89 |
flagging_callback=hf_writer
|
90 |
)
|
91 |
iface.launch()
|