By Andrew Huang, Sophia Yang, Philipp Rudiger
HoloViz Panel is a flexible Python library that empowers builders and information scientists to construct interactive visualizations with ease. Whether or not you’re engaged on machine studying tasks, creating internet purposes, or designing information dashboards, Panel offers a strong set of instruments and options to boost your information exploration and presentation capabilities. On this weblog publish, we’ll delve into the thrilling options of HoloViz Panel, discover the way it can revolutionize your information visualization workflows, and show how one can make an app like this utilizing about 100 traces of code.
Check out the app and take a look at the code:
ML/AI has turn out to be an integral a part of information evaluation and decision-making processes. With Panel, you possibly can seamlessly combine ML fashions and outcomes into your visualizations. On this weblog publish, we’ll discover methods to make a picture classification job utilizing the OpenAI CLIP mannequin.
CLIP is pretrained on a big dataset of image-text pairs, enabling it to grasp photographs and corresponding textual descriptions and work for varied downstream duties resembling picture classification.
There are two ML-related capabilities we used to carry out the picture classification job. The primary operate load_processor_model allows us to load a pre-trained CLIP mannequin from Hugging Face. The second operate get_similarity_score calculates the diploma of similarity between the picture and a offered record of sophistication labels.
@pn.cachedef load_processor_model(processor_name: str, model_name: str) -> Tuple[CLIPProcessor, CLIPModel]:processor = CLIPProcessor.from_pretrained(processor_name)mannequin = CLIPModel.from_pretrained(model_name)return processor, mannequin
def get_similarity_scores(class_items: Record[str], picture: Picture) -> Record[float]:processor, mannequin = load_processor_model(“openai/clip-vit-base-patch32”, “openai/clip-vit-base-patch32”)inputs = processor(…