Spaces:
Sleeping
Sleeping
Update app.py
Browse filesRemoved deprecated .style methods
app.py
CHANGED
|
@@ -237,8 +237,8 @@ with gr.Blocks() as demo:
|
|
| 237 |
"""
|
| 238 |
gr.Markdown(instructions)
|
| 239 |
with gr.Row(variant="compact"):
|
| 240 |
-
label_text = gr.Textbox(show_label=False, placeholder="Enter classification labels"
|
| 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",
|
|
@@ -246,10 +246,10 @@ with gr.Blocks() as demo:
|
|
| 246 |
"day, night, dawn, dusk"], inputs=label_text)
|
| 247 |
with gr.Row():
|
| 248 |
with gr.Column(variant="panel"):
|
| 249 |
-
im = gr.Image(interactive=False
|
| 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
|
|
@@ -272,11 +272,11 @@ with gr.Blocks() as demo:
|
|
| 272 |
gr.Markdown(instructions)
|
| 273 |
with gr.Row():
|
| 274 |
with gr.Column(variant="panel"):
|
| 275 |
-
im_cap = gr.Image(interactive=False
|
| 276 |
-
model_name = gr.Radio(choices=["COCO","Conceptual Captions"], type="value", value="COCO", label="Model"
|
| 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)
|
|
@@ -290,15 +290,15 @@ with gr.Blocks() as demo:
|
|
| 290 |
3. Keep in mind that the dataset contains mostly nature-focused images"""
|
| 291 |
gr.Markdown(instructions)
|
| 292 |
with gr.Column(variant="panel"):
|
| 293 |
-
desc = gr.Textbox(show_label=False, placeholder="Enter description"
|
| 294 |
gr.Examples(["someone holding flowers",
|
| 295 |
"someone holding pink flowers",
|
| 296 |
"red fruit in a person's hands",
|
| 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
|
| 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}")
|
| 304 |
|
|
|
|
| 237 |
"""
|
| 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", full_width=False)
|
| 242 |
gr.Examples(["spring, summer, fall, winter",
|
| 243 |
"mountain, city, beach, ocean, desert, forest, valley",
|
| 244 |
"red, blue, green, white, black, purple, brown",
|
|
|
|
| 246 |
"day, night, dawn, dusk"], inputs=label_text)
|
| 247 |
with gr.Row():
|
| 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", full_width=False)
|
| 252 |
+
class_btn = gr.Button("Classify Image", full_width=False)
|
| 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
|
|
|
|
| 272 |
gr.Markdown(instructions)
|
| 273 |
with gr.Row():
|
| 274 |
with gr.Column(variant="panel"):
|
| 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", full_width=False)
|
| 279 |
+
caption_btn = gr.Button("Create Caption", full_width=False)
|
| 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)
|
|
|
|
| 290 |
3. Keep in mind that the dataset contains mostly nature-focused images"""
|
| 291 |
gr.Markdown(instructions)
|
| 292 |
with gr.Column(variant="panel"):
|
| 293 |
+
desc = gr.Textbox(show_label=False, placeholder="Enter description", container=False)
|
| 294 |
gr.Examples(["someone holding flowers",
|
| 295 |
"someone holding pink flowers",
|
| 296 |
"red fruit in a person's hands",
|
| 297 |
"an aerial view of forest",
|
| 298 |
"a waterfall in Iceland with a rainbow"
|
| 299 |
], inputs=desc)
|
| 300 |
+
search_btn = gr.Button("Find Images"), full_width=False)
|
| 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}")
|
| 304 |
|