Skip to content

Instantly share code, notes, and snippets.

@koaning
Created June 13, 2022 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koaning/8f96edcdd6f2efbec76a8410dfc102d9 to your computer and use it in GitHub Desktop.
Save koaning/8f96edcdd6f2efbec76a8410dfc102d9 to your computer and use it in GitHub Desktop.
Prodigy Instructions
import base64
import pathlib
from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(
loader=FileSystemLoader("images"),
autoescape=select_autoescape()
)
template = env.get_template("instructions.template")
with open("images/img4.png", "rb") as image_file:
enc_noa = base64.b64encode(image_file.read())
with open("images/img5.png", "rb") as image_file:
enc_sok = base64.b64encode(image_file.read())
rendered = template.render(enc_noa=enc_noa.decode('utf-8'), enc_sok=enc_sok.decode('utf-8'))
pathlib.Path("instructions.html").write_text(rendered)
<h1>Detecting Cats</h1>
<p>In this dataset there are two cats that we'd like to detect.</p>
<br>
<h2>Noa</h2>
<p>Noa is the white cat. She has some distinctive shapes on her forehead. </p>
<img src="data:image/png;base64, {{ enc_noa }}"/>
<br>
<br>
<h2>Sok</h2>
<p>Sok is the black cat. She's usually a bit shy.</p>
<img src="data:image/png;base64, {{ enc_sok }}"/>
<br>
<br>
<h2>No cat?</h2>
<p>It's perfectly fine if there's no cat in the photo, but only Noa and Sok need to be annotated. You're supposed to ignore any other cats in the photo.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment