Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,21 +13,22 @@ def validate(item_id: str, threshold: float):
|
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
gr.Markdown("""
|
| 15 |
# Off topic image detector
|
| 16 |
-
This app takes an item ID and classifies its pictures as valid/invalid depending on whether they relate to the domain in which it's been listed.
|
| 17 |
-
""")
|
| 18 |
item_id = gr.Textbox(label="Item ID")
|
| 19 |
threshold = gr.Number(label="Threshold", value=0.5)
|
| 20 |
submit = gr.Button("Submit")
|
| 21 |
-
domain = gr.Markdown()
|
| 22 |
-
valid = gr.Gallery(label="Valid images").style(grid=[1, 2, 3], height="auto")
|
| 23 |
-
invalid = gr.Gallery(label="Invalid images").style(grid=[1, 2, 3], height="auto")
|
| 24 |
-
submit.click(inputs=[item_id, threshold], outputs=[domain, valid, invalid], fn=validate)
|
| 25 |
gr.Examples(
|
| 26 |
-
examples=[["MLU449951849", 0.
|
| 27 |
inputs=[item_id, threshold],
|
| 28 |
outputs=[domain, valid, invalid],
|
| 29 |
fn=validate,
|
| 30 |
cache_examples=True,
|
| 31 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
demo.launch()
|
|
|
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
gr.Markdown("""
|
| 15 |
# Off topic image detector
|
| 16 |
+
## This app takes an item ID and classifies its pictures as valid/invalid depending on whether they relate to the domain in which it's been listed.
|
| 17 |
+
Input an item ID or select one of the preloaded examples below.""")
|
| 18 |
item_id = gr.Textbox(label="Item ID")
|
| 19 |
threshold = gr.Number(label="Threshold", value=0.5)
|
| 20 |
submit = gr.Button("Submit")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
gr.Examples(
|
| 22 |
+
examples=[["MLU449951849", 0.3], ["MLA1293465558", 0.3], ["MLB3184663685", 0.3], ["MLC1392230619", 0.3]],
|
| 23 |
inputs=[item_id, threshold],
|
| 24 |
outputs=[domain, valid, invalid],
|
| 25 |
fn=validate,
|
| 26 |
cache_examples=True,
|
| 27 |
)
|
| 28 |
+
domain = gr.Markdown()
|
| 29 |
+
valid = gr.Gallery(label="Valid images").style(grid=[1, 2, 3], height="auto")
|
| 30 |
+
invalid = gr.Gallery(label="Invalid images").style(grid=[1, 2, 3], height="auto")
|
| 31 |
+
submit.click(inputs=[item_id, threshold], outputs=[domain, valid, invalid], fn=validate)
|
| 32 |
+
|
| 33 |
|
| 34 |
demo.launch()
|