Spaces:
Running
Running
Commit
·
2f7ee87
1
Parent(s):
bd2bba7
Add rating and description parameters to flag_img_input function in app.py, enhancing user feedback capabilities and updating the UI to accommodate new inputs.
Browse files
app.py
CHANGED
@@ -70,12 +70,13 @@ def inference(image):
|
|
70 |
|
71 |
def flag_img_input(
|
72 |
image: gr.Image,
|
73 |
-
name: str = "
|
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)
|
79 |
|
80 |
# Decode blob data if necessary
|
81 |
if is_blob_data(image):
|
@@ -85,6 +86,8 @@ def flag_img_input(
|
|
85 |
"name": name,
|
86 |
"email": email,
|
87 |
"subscribe": subscribe,
|
|
|
|
|
88 |
}
|
89 |
|
90 |
hf_writer.flag([image], metadata=metadata)
|
@@ -162,6 +165,8 @@ with gr.Blocks(theme=theme, css=css, title="SEA.AI Vision Demo") as demo:
|
|
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,7 +179,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, name_, email_, subscribe_],
|
178 |
[],
|
179 |
preprocess=False,
|
180 |
show_api=True,
|
|
|
70 |
|
71 |
def flag_img_input(
|
72 |
image: gr.Image,
|
73 |
+
name: str = "anonymous",
|
74 |
email: str = "[email protected]",
|
75 |
subscribe: bool = False,
|
76 |
+
rating: int = 0,
|
77 |
+
description: str = "",
|
78 |
):
|
79 |
"""Wrapper for flagging"""
|
|
|
80 |
|
81 |
# Decode blob data if necessary
|
82 |
if is_blob_data(image):
|
|
|
86 |
"name": name,
|
87 |
"email": email,
|
88 |
"subscribe": subscribe,
|
89 |
+
"rating": rating,
|
90 |
+
"description": description,
|
91 |
}
|
92 |
|
93 |
hf_writer.flag([image], metadata=metadata)
|
|
|
165 |
name_ = gr.Textbox(label="name", visible=False, value="anonymous")
|
166 |
email_ = gr.Textbox(label="email", visible=False, value="[email protected]")
|
167 |
subscribe_ = gr.Checkbox(label="subscribe", value=False, visible=False)
|
168 |
+
rating_ = gr.Slider(label="rating", value=0, minimum=0, maximum=5, step=1, visible=False)
|
169 |
+
description_ = gr.Textbox(label="description", visible=False, value="")
|
170 |
|
171 |
# This needs to be called prior to the first call to callback.flag()
|
172 |
hf_writer.setup([img_input], "flagged")
|
|
|
179 |
show_api=False,
|
180 |
).then(
|
181 |
flag_img_input,
|
182 |
+
[img_input, name_, email_, subscribe_, rating_, description_],
|
183 |
[],
|
184 |
preprocess=False,
|
185 |
show_api=True,
|