Spaces:
Sleeping
Sleeping
Update app.py
Browse filesmore updates to match new Gradio api
app.py
CHANGED
|
@@ -238,7 +238,7 @@ with gr.Blocks() as demo:
|
|
| 238 |
gr.Markdown(instructions)
|
| 239 |
with gr.Row(variant="compact"):
|
| 240 |
label_text = gr.Textbox(show_label=False, placeholder="Enter classification labels", container=False)
|
| 241 |
-
#submit_btn = gr.Button("Submit",
|
| 242 |
gr.Examples(["spring, summer, fall, winter",
|
| 243 |
"mountain, city, beach, ocean, desert, forest, valley",
|
| 244 |
"red, blue, green, white, black, purple, brown",
|
|
@@ -248,8 +248,8 @@ with gr.Blocks() as demo:
|
|
| 248 |
with gr.Column(variant="panel"):
|
| 249 |
im = gr.Image(interactive=False, height=height)
|
| 250 |
with gr.Row():
|
| 251 |
-
get_btn = gr.Button("Get Random Image",
|
| 252 |
-
class_btn = gr.Button("Classify Image",
|
| 253 |
cf = gr.Label()
|
| 254 |
#submit_btn.click(fn=set_labels, inputs=label_text)
|
| 255 |
label_text.change(fn=set_labels, inputs=label_text, outputs=labels) # parse list if changed
|
|
@@ -275,8 +275,8 @@ with gr.Blocks() as demo:
|
|
| 275 |
im_cap = gr.Image(interactive=False, height=height)
|
| 276 |
model_name = gr.Radio(choices=["COCO","Conceptual Captions"], type="value", value="COCO", label="Model", container=True, item_container = False)
|
| 277 |
with gr.Row():
|
| 278 |
-
get_btn_cap = gr.Button("Get Random Image",
|
| 279 |
-
caption_btn = gr.Button("Create Caption",
|
| 280 |
caption = gr.Textbox(label='Caption', elem_classes="caption-text")
|
| 281 |
get_btn_cap.click(fn=rand_image, outputs=im_cap)
|
| 282 |
#im_cap.change(generate_text, inputs=im_cap, outputs=caption)
|
|
@@ -297,7 +297,7 @@ with gr.Blocks() as demo:
|
|
| 297 |
"an aerial view of forest",
|
| 298 |
"a waterfall in Iceland with a rainbow"
|
| 299 |
], inputs=desc)
|
| 300 |
-
search_btn = gr.Button("Find Images",
|
| 301 |
gallery = gr.Gallery(show_label=False, grid=(2,2,3,5))
|
| 302 |
search_btn.click(search,inputs=desc, outputs=gallery, postprocess=False)
|
| 303 |
gr.HTML(f"Dataset: <a href='https://github.com/unsplash/datasets' target='_blank'>Unsplash Lite</a>; Number of Images: {dataset_size}")
|
|
|
|
| 238 |
gr.Markdown(instructions)
|
| 239 |
with gr.Row(variant="compact"):
|
| 240 |
label_text = gr.Textbox(show_label=False, placeholder="Enter classification labels", container=False)
|
| 241 |
+
#submit_btn = gr.Button("Submit", scale = 1)
|
| 242 |
gr.Examples(["spring, summer, fall, winter",
|
| 243 |
"mountain, city, beach, ocean, desert, forest, valley",
|
| 244 |
"red, blue, green, white, black, purple, brown",
|
|
|
|
| 248 |
with gr.Column(variant="panel"):
|
| 249 |
im = gr.Image(interactive=False, height=height)
|
| 250 |
with gr.Row():
|
| 251 |
+
get_btn = gr.Button("Get Random Image", scale = 1)
|
| 252 |
+
class_btn = gr.Button("Classify Image", scale = 1)
|
| 253 |
cf = gr.Label()
|
| 254 |
#submit_btn.click(fn=set_labels, inputs=label_text)
|
| 255 |
label_text.change(fn=set_labels, inputs=label_text, outputs=labels) # parse list if changed
|
|
|
|
| 275 |
im_cap = gr.Image(interactive=False, height=height)
|
| 276 |
model_name = gr.Radio(choices=["COCO","Conceptual Captions"], type="value", value="COCO", label="Model", container=True, item_container = False)
|
| 277 |
with gr.Row():
|
| 278 |
+
get_btn_cap = gr.Button("Get Random Image", scale =1 )
|
| 279 |
+
caption_btn = gr.Button("Create Caption", scale = 1)
|
| 280 |
caption = gr.Textbox(label='Caption', elem_classes="caption-text")
|
| 281 |
get_btn_cap.click(fn=rand_image, outputs=im_cap)
|
| 282 |
#im_cap.change(generate_text, inputs=im_cap, outputs=caption)
|
|
|
|
| 297 |
"an aerial view of forest",
|
| 298 |
"a waterfall in Iceland with a rainbow"
|
| 299 |
], inputs=desc)
|
| 300 |
+
search_btn = gr.Button("Find Images", scale = 1)
|
| 301 |
gallery = gr.Gallery(show_label=False, grid=(2,2,3,5))
|
| 302 |
search_btn.click(search,inputs=desc, outputs=gallery, postprocess=False)
|
| 303 |
gr.HTML(f"Dataset: <a href='https://github.com/unsplash/datasets' target='_blank'>Unsplash Lite</a>; Number of Images: {dataset_size}")
|