Skip to main content

Render Featrix Sphere Model Card JSON to HTML or plain text

Project description

Featrix Model Card - Python Package

Python package for rendering Featrix Model Card JSON to HTML or plain text.

HTML rendering delegates to the canonical JavaScript renderer loaded from CDN, ensuring the Python output always matches the JS version.

Text rendering is a standalone Python implementation for terminal/log output.

Installation

pip install featrix-modelcard

Usage

HTML Renderer

The HTML renderer generates a standalone page that loads model-card.js from the Featrix CDN. The JavaScript renderer handles all layout, styling, and interactivity.

from featrix_modelcard import render_html, render_html_to_file

# Load model card JSON
import json
with open('model_card.json', 'r') as f:
    model_card = json.load(f)

# Render to file
render_html_to_file(model_card, 'output.html')

# Render to string
html = render_html(model_card)

# With 3D sphere visualization
html = render_html(model_card, show_sphere=True)

# With explicit session ID for sphere
html = render_html(model_card, show_sphere=True, session_id='my-session-id')

# Override CDN URL (e.g. for local development)
html = render_html(model_card, cdn_url='http://localhost:8080/model-card.js')

Text Renderer

from featrix_modelcard import render_brief_text, render_detailed_text, print_text

# Brief summary
print_text(model_card, detailed=False)

# Detailed output
print_text(model_card, detailed=True)

# Get as strings
brief = render_brief_text(model_card)
detailed = render_detailed_text(model_card)

API Reference

HTML Functions

  • render_html(model_card_json, *, show_sphere=False, session_id=None, cdn_url=None) -> str
  • render_html_to_file(model_card_json, output_path, *, show_sphere=False, session_id=None, cdn_url=None) -> str
  • print_html(model_card_json, file=None, **kwargs) -> str

Text Functions

  • render_brief_text(model_card_json) -> str
  • render_detailed_text(model_card_json) -> str
  • render_text_to_file(model_card_json, output_path, detailed=True) -> str
  • print_text(model_card_json, detailed=True, file=None) -> str

Architecture

The HTML renderer is a thin wrapper that embeds your model card JSON into a page that loads the canonical FeatrixModelCard JavaScript renderer from the CDN. This means:

  • Python HTML output is always in sync with the JS version
  • No rendering logic to maintain in Python
  • All styling, interactivity, and features come from the JS renderer
  • Zero external Python dependencies

The text renderer is a standalone Python implementation for use in terminals, logs, and non-browser contexts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

featrix_modelcard-1.16.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

featrix_modelcard-1.16-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file featrix_modelcard-1.16.tar.gz.

File metadata

  • Download URL: featrix_modelcard-1.16.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for featrix_modelcard-1.16.tar.gz
Algorithm Hash digest
SHA256 708047080160e51cd50a6d29ef4982b5faedbf9965e84b201cb536497747db82
MD5 7a75de9fc4d546fc7f52d68e49a6d187
BLAKE2b-256 e6086145857ec7dd61d4d48d1beac14afc42268e8a0441b7bb5ebc1e9e5dcbfd

See more details on using hashes here.

File details

Details for the file featrix_modelcard-1.16-py3-none-any.whl.

File metadata

File hashes

Hashes for featrix_modelcard-1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 76dd1b03dcd13756dd8cc88e2e4d5aa49d1a66c8b6bec4c8032d2a19727f3fd3
MD5 d2084dabf71d037755e47f1a874d006a
BLAKE2b-256 b865fca1a2517fc4ef8ef2313a0f615fe218d6e5135b32a8c9aae506ba7d3562

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page