Trying to add some safety checking.
Browse files
app.py
CHANGED
|
@@ -183,11 +183,22 @@ h1#title {
|
|
| 183 |
'''
|
| 184 |
demo = gr.Blocks(css=css)
|
| 185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
with demo:
|
| 187 |
gr.Markdown(title)
|
| 188 |
gr.Markdown(description)
|
| 189 |
# gr.Markdown(twitter_link)
|
| 190 |
options = gr.Dropdown(choices=models,label='Select Object Detection Model',show_label=True)
|
|
|
|
| 191 |
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.7,label='Prediction Threshold')
|
| 192 |
|
| 193 |
|
|
@@ -201,7 +212,7 @@ with demo:
|
|
| 201 |
with gr.Row():
|
| 202 |
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
| 203 |
|
| 204 |
-
url_but = gr.Button('Detect')
|
| 205 |
|
| 206 |
with gr.TabItem('Image Upload'):
|
| 207 |
with gr.Row():
|
|
@@ -213,8 +224,10 @@ with demo:
|
|
| 213 |
samples=[[path.as_posix()]
|
| 214 |
for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
|
| 215 |
|
| 216 |
-
img_but = gr.Button('Detect')
|
| 217 |
|
|
|
|
|
|
|
| 218 |
# output_text1 = gr.outputs.Textbox(label="Confidence Values")
|
| 219 |
output_text1 = gr.components.Textbox(label="Confidence Values")
|
| 220 |
# https://huggingface.co/spaces/vishnun/CLIPnCROP/blob/main/app.py -- Got .outputs. from this
|
|
|
|
| 183 |
'''
|
| 184 |
demo = gr.Blocks(css=css)
|
| 185 |
|
| 186 |
+
|
| 187 |
+
def changing(b1, b2, inVal, outBox):
|
| 188 |
+
if inVal:
|
| 189 |
+
b1.interactive = "True"
|
| 190 |
+
b2.interactive = "False"
|
| 191 |
+
else:
|
| 192 |
+
outBox.value = "Select Dropdown"
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
|
| 196 |
with demo:
|
| 197 |
gr.Markdown(title)
|
| 198 |
gr.Markdown(description)
|
| 199 |
# gr.Markdown(twitter_link)
|
| 200 |
options = gr.Dropdown(choices=models,label='Select Object Detection Model',show_label=True)
|
| 201 |
+
|
| 202 |
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.7,label='Prediction Threshold')
|
| 203 |
|
| 204 |
|
|
|
|
| 212 |
with gr.Row():
|
| 213 |
example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
|
| 214 |
|
| 215 |
+
url_but = gr.Button('Detect', interactive="False")
|
| 216 |
|
| 217 |
with gr.TabItem('Image Upload'):
|
| 218 |
with gr.Row():
|
|
|
|
| 224 |
samples=[[path.as_posix()]
|
| 225 |
for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
|
| 226 |
|
| 227 |
+
img_but = gr.Button('Detect', interactive="False")
|
| 228 |
|
| 229 |
+
options.change(fn=changing, inputs=[img_but, url_but, options.value, output_text1])
|
| 230 |
+
|
| 231 |
# output_text1 = gr.outputs.Textbox(label="Confidence Values")
|
| 232 |
output_text1 = gr.components.Textbox(label="Confidence Values")
|
| 233 |
# https://huggingface.co/spaces/vishnun/CLIPnCROP/blob/main/app.py -- Got .outputs. from this
|