Trying to get buttons to work
Browse files
app.py
CHANGED
@@ -114,20 +114,18 @@ def segment_images(model_name,url_input,image_input,threshold):
|
|
114 |
def set_example_image(example: list) -> dict:
|
115 |
# return gr.Image.update(value=example[0])
|
116 |
try:
|
117 |
-
print("here1")
|
118 |
-
print(example[0])
|
119 |
return gr.Image(value=example[0]["path"])
|
120 |
except error as e:
|
|
|
121 |
print(e)
|
122 |
-
|
123 |
|
124 |
def set_example_url(example: list) -> dict:
|
125 |
# return gr.Textbox.update(value=example[0])
|
126 |
try:
|
127 |
-
print("here2")
|
128 |
-
print(example[0])
|
129 |
return gr.Image(value=example[0]["path"])
|
130 |
except error as e:
|
|
|
131 |
print(e)
|
132 |
return gr.Image(example[0])
|
133 |
|
@@ -164,7 +162,7 @@ def changing():
|
|
164 |
# https://discuss.huggingface.co/t/how-to-programmatically-enable-or-disable-components/52350/4
|
165 |
# return gr.Button.update(interactive=True), gr.Button.update(interactive=True)
|
166 |
# return gr.Button(interactive=True), gr.Button(interactive=True)
|
167 |
-
return gr.Button('Detect'), gr.Button('Detect')
|
168 |
|
169 |
|
170 |
with demo:
|
|
|
114 |
def set_example_image(example: list) -> dict:
|
115 |
# return gr.Image.update(value=example[0])
|
116 |
try:
|
|
|
|
|
117 |
return gr.Image(value=example[0]["path"])
|
118 |
except error as e:
|
119 |
+
print("In function: set_example_image")
|
120 |
print(e)
|
121 |
+
raise e
|
122 |
|
123 |
def set_example_url(example: list) -> dict:
|
124 |
# return gr.Textbox.update(value=example[0])
|
125 |
try:
|
|
|
|
|
126 |
return gr.Image(value=example[0]["path"])
|
127 |
except error as e:
|
128 |
+
print("In function: set_example_image")
|
129 |
print(e)
|
130 |
return gr.Image(example[0])
|
131 |
|
|
|
162 |
# https://discuss.huggingface.co/t/how-to-programmatically-enable-or-disable-components/52350/4
|
163 |
# return gr.Button.update(interactive=True), gr.Button.update(interactive=True)
|
164 |
# return gr.Button(interactive=True), gr.Button(interactive=True)
|
165 |
+
return gr.Button('Detect', interactive=True), gr.Button('Detect', interactive=True)
|
166 |
|
167 |
|
168 |
with demo:
|