Image
Introduction
Image
widget in Supervisely is a simple widget that displays images using the HTML <img>
tag, and is convenient to use when there is no need to add extra functions for displaying annotations or adjusting their settings, but only to display the image passed to it by url or local path.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Image url or local path to image on the host |
|
| Image width in pixels or percent |
|
| Image height in pixels or percent |
|
| ID of the widget |
url
Image url or local path to image on the host. Determines image to be displayed on widget.
type: str
default value: ""
width
Image width in pixels or percent.
type: Optional[Union[int, str]]
default value: None
height
Image height in pixels or percent.
type: Optional[Union[int, str]]
default value: None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set image by url in |
| Clean |
| Set image size in |
| Show |
| Hide |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/media/001_image/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Get images infos from server
Get images urls
Initialize Image
widgets we will use in UI
Image
widgets we will use in UIDeclare static files directory path and initialize Image
using image from local directory
Image
using image from local directoryCreate app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Define static_dir
parameter for using files from local directory. Create an app object with layout
parameter.
Last updated