Skip to content

Commit fdc41f0

Browse files
committed
Surfaced extra captions via a image lightbox
Added in this update: - Ability to "expand" an image into a lightbox that show all 3 image captions generated - Added Featherlight and Glyphicon libraries for the above functionality - Added new image detail endpoint that returns the html snippet used in the lightbox
1 parent fb1057a commit fdc41f0

14 files changed

+395
-7
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ This web app includes the following js and css libraries
5757
- [Image Picker](http://rvera.github.io/image-picker/)
5858
- [d3-cloud](https://github.com/jasondavies/d3-cloud)
5959
- [D3.js](https://d3js.org)
60-
- [Bootstrap 3](https://getbootstrap.com)
60+
- [Featherlight](https://noelboss.github.io/featherlight/)
6161
- [JQuery](https://jquery.com)
62+
- [Bootstrap 3](https://getbootstrap.com)
63+
- [Glyphicons](http://glyphicons.com)

app.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ def get(self):
2020
self.render("index.html", image_captions=image_captions)
2121

2222

23+
class DetailHandler(web.RequestHandler):
24+
def get(self):
25+
image = self.get_argument('image', None)
26+
if not image:
27+
self.set_status(400)
28+
return self.finish("400: Missing image parameter")
29+
if image not in image_captions:
30+
self.set_status(404)
31+
return self.finish("404: Image not found")
32+
self.render("detail-snippet.html", image=image, predictions=image_captions[image])
33+
34+
2335
class CleanupHandler(web.RequestHandler):
2436
def get(self):
2537
self.render("cleanup.html")
@@ -92,7 +104,8 @@ def make_app():
92104
handlers = [
93105
(r"/", MainHandler),
94106
(r"/upload", UploadHandler),
95-
(r"/cleanup", CleanupHandler)
107+
(r"/cleanup", CleanupHandler),
108+
(r"/detail", DetailHandler)
96109
]
97110

98111
configs = {

static/css/bootstrap.min.css

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/css/featherlight.min.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/css/webapp.css

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Style sheet for MAX Image Caption Generator Web App */
22

3-
body .ibm-code {
3+
body {
44
font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
55
}
66

@@ -63,4 +63,39 @@ body .ibm-code {
6363

6464
.ibm-code ul.thumbnails.image_picker_selector li .thumbnail.selected {
6565
background: #5FBFBB;
66-
}
66+
}
67+
68+
.ibm-code .thumbnail {
69+
display: inline-block;
70+
position: relative;
71+
}
72+
73+
.thumbnails .more-info-icon {
74+
position: absolute;
75+
top: 0;
76+
right: 0;
77+
padding: 6px;
78+
background: #FFFFFF;
79+
border-radius: 4px;
80+
font-size: 1.2em;
81+
}
82+
83+
a.more-info-icon {
84+
color: inherit;
85+
text-decoration: inherit;
86+
}
87+
88+
.thumbnails .selected .more-info-icon {
89+
background: #5FBFBB;
90+
}
91+
92+
.featherlight .featherlight-content {
93+
border-radius: 4px;
94+
background: #5FBFBB;
95+
border-bottom: 0;
96+
max-width: 100vh;
97+
}
98+
99+
.featherlight .featherlight-close-icon {
100+
background: #5FBFBB;
101+
}
19.7 KB
Binary file not shown.

static/fonts/glyphicons-halflings-regular.svg

Lines changed: 288 additions & 0 deletions
Loading
44.3 KB
Binary file not shown.
22.9 KB
Binary file not shown.
17.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)