Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
hearmeneigh committed Nov 27, 2023
1 parent fb9a692 commit 69ebb70
Show file tree
Hide file tree
Showing 29 changed files with 344 additions and 2,510 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ script:

```bash
# generate a HTML preview of how the selector will perform (note: --aggregate is required):
dr-preview --selector ./examples/select/curated.yaml --output /tmp/curated-previews --limit 1000 --output --aggregate
dr-preview --selector ./examples/select/tier-1/tier-1.yaml --output /tmp/preview/tier-1 --limit 1000 --output --aggregate

# generate a HTML preview of how each sub-selector will perform:
dr-preview --selector ./examples/select/positive/artists.yaml --output /tmp/curated-artists
dr-preview --selector ./examples/select/tier-1/helpers/artists.yaml --output /tmp/preview/tier-1-artists
```

### 4. Select Images For a Dataset
Expand All @@ -110,10 +110,8 @@ building a dataset. Use `dr-select` to select posts from the database and store
```bash
cd <dataset-rising>/database

dr-select --selector ./examples/select/curated.yaml --output /tmp/curated.jsonl
dr-select --selector ./examples/select/negative.yaml --output /tmp/negative.jsonl
dr-select --selector ./examples/select/positive.yaml --output /tmp/positive.jsonl
dr-select --selector ./examples/select/uncurated.yaml --output /tmp/uncurated.jsonl
dr-select --selector ./examples/select/tier-1/tier-1.yaml --output /tmp/tier-1.jsonl
dr-select --selector ./examples/select/tier-2/tier-2.yaml --output /tmp/tier-2.jsonl
```

### 5. Build a Dataset
Expand All @@ -128,10 +126,8 @@ Adding a percentage at the end of a `--source` tells the build script to pick th

```bash
dr-join \
--samples '/tmp/curated.jsonl:30%' \
--samples '/tmp/positive.jsonl:40%' \
--samples '/tmp/negative.jsonl:20%' \
--samples '/tmp/uncurated.jsonl:10%' \
--samples '/tmp/tier-1.jsonl:80%' \
--samples '/tmp/tier-2.jsonl:20%' \
--output '/tmp/joined.jsonl'

dr-build \
Expand Down
136 changes: 106 additions & 30 deletions examples/preview/preview.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,138 @@
<title>Gallery: {{ title }}</title>
<style>
li img {
max-width: 150px;
max-height: 150px;
max-width: 275px;
max-height: 275px;
}
li {
float: left;
list-style: none;
margin-left: 10px;
width: 150px;
height: 150px;
}
h3 {
clear: both;
margin-top: 2rem;
width: 275px;
height: 275px;
}
ul {
padding: 0;
margin: 0;
display: inline-block;
}
section {
background: rgb(176,227,205);
background: linear-gradient(180deg, rgb(247 253 212) 0%, rgba(215,255,238,1) 100%);
padding: 1rem;
margin: 0;
margin-top: 1rem;
margin-bottom: 1rem;
border-radius: 0.25em;
}
section ul li img {
display: block;
border-radius: 0.25em;
}
section ul li {
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
section ul li a {
display: block;
width: min-content;
}
section h3 {
margin-top: 0;
font-family:sans-serif !important;
font-weight:normal;
}
section h3 small {
color: grey;
}
section h3 a {
text-decoration: none;
color: #003dff;
}
section h3 a:hover {
text-decoration: underline;
color: #0031c9;
}
h1 {
font-family:sans-serif !important;
font-weight:normal;
font-size: 20pt;
color: #4e6f86;
}
section li img {
border: 1px solid rgba(0, 0, 0, 0);
}
section li img:hover {
filter: brightness(1.2) sepia(50%);
border: 1px solid rgb(78 111 134 / 10%);
}
nav {
font-family: sans-serif;
margin-top: 1.5em;
margin-bottom: 2em;
width: 100%;
text-align: center;
}
</style>
</head>
<body>
<h1>{{ title }}</h1>

{% for tag in tags %}
<h3>{{ tag.title }} {% if tag.total_count %}<small>({{ tag.total_count }} total)</small>{% endif %}</h3>

{% if tag.images %}
<ul>
{% for im in tag.images %}
<li>
<a href="{{ im.image_url }}" target="_blank">
<img alt="{{ im.source }}: #{{ im.source_id }}" src="{{ im.small_url }}" />
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p><i>No images found.</i></p>
{% endif %}
<section>
<h3>
{% if tag.url %}
<a href="{{ tag.url }}">{{ tag.title }}</a>
{% else %}
{{ tag.title }}
{% endif %}

{% if tag.total_count %}<small>({{ "{:,.0f}".format(tag.total_count) }})</small>{% endif %}
</h3>

{% if tag.images %}
<ul>
{% for im in tag.images %}
<li>
<a href="{{ im | get_post_url }}" title="Matches: {{ ', '.join(im.matches) }}">
<img alt="Matches: {{ ', '.join(im.matches) }}" src="{{ im.medium_url if im.medium_url is not none else (im.image_url if im.image_url is not none else missing_image_url) }}" />
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p><i>No images found.</i></p>
{% endif %}
</section>
{% endfor %}

{% if pagination %}
<div>
{% if pagination.next %}
<a href="{{ pagination.next }}">Next &gt;</a>
{% endif %}
{% if pagination.next and pagination.prev %} | {% endif %}
<nav>
{% if pagination.prev %}
<a href="{{ pagination.prev }}">&lt; Prev</a>
{% endif %}
</div>
{% if pagination.next and pagination.prev %} | {% endif %}
{% if pagination.next %}
<a href="{{ pagination.next }}">Next &gt;</a>
{% endif %}
</nav>
{% endif %}

</body>
Expand Down
30 changes: 0 additions & 30 deletions examples/select/curated.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions examples/select/negative.yaml

This file was deleted.

66 changes: 0 additions & 66 deletions examples/select/negative/artists-curated.yaml

This file was deleted.

Loading

0 comments on commit 69ebb70

Please sign in to comment.