Spaces:
Running
Running
Commit
·
5604d24
1
Parent(s):
3928c4d
Refactor flag_img_input parameters in app.py for consistency and clarity, renaming variables to align with function arguments.
Browse files
app.py
CHANGED
@@ -70,9 +70,9 @@ def inference(image):
|
|
70 |
|
71 |
def flag_img_input(
|
72 |
image: gr.Image,
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
):
|
77 |
"""Wrapper for flagging"""
|
78 |
logger.info("Flagging image - name: %s, email: %s, subscribe: %s", name_, email_, subscribe_)
|
@@ -159,9 +159,9 @@ with gr.Blocks(theme=theme, css=css, title="SEA.AI Vision Demo") as demo:
|
|
159 |
}
|
160 |
|
161 |
# add hidden textbox for name and email (hacky but well...)
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
|
166 |
# This needs to be called prior to the first call to callback.flag()
|
167 |
hf_writer.setup([img_input], "flagged")
|
@@ -174,7 +174,7 @@ with gr.Blocks(theme=theme, css=css, title="SEA.AI Vision Demo") as demo:
|
|
174 |
show_api=False,
|
175 |
).then(
|
176 |
flag_img_input,
|
177 |
-
[img_input,
|
178 |
[],
|
179 |
preprocess=False,
|
180 |
show_api=True,
|
|
|
70 |
|
71 |
def flag_img_input(
|
72 |
image: gr.Image,
|
73 |
+
name: str = "misdetection",
|
74 |
+
email: str = "[email protected]",
|
75 |
+
subscribe: bool = False,
|
76 |
):
|
77 |
"""Wrapper for flagging"""
|
78 |
logger.info("Flagging image - name: %s, email: %s, subscribe: %s", name_, email_, subscribe_)
|
|
|
159 |
}
|
160 |
|
161 |
# add hidden textbox for name and email (hacky but well...)
|
162 |
+
name_ = gr.Textbox(label="name", visible=False, value="anonymous")
|
163 |
+
email_ = gr.Textbox(label="email", visible=False, value="[email protected]")
|
164 |
+
subscribe_ = gr.Checkbox(label="subscribe", value=False, visible=False)
|
165 |
|
166 |
# This needs to be called prior to the first call to callback.flag()
|
167 |
hf_writer.setup([img_input], "flagged")
|
|
|
174 |
show_api=False,
|
175 |
).then(
|
176 |
flag_img_input,
|
177 |
+
[img_input, name_, email_, subscribe_],
|
178 |
[],
|
179 |
preprocess=False,
|
180 |
show_api=True,
|