gradio_calendar
Gradio component for selecting dates with a calendar 📆
Installation
pip install gradio_calendar
Usage
import gradio as gr
from gradio_calendar import Calendar
import datetime
def is_weekday(date: datetime.datetime):
return date.weekday() < 5
demo = gr.Interface(is_weekday,
[Calendar(type="datetime", label="Select a date", info="Click the calendar icon to bring up the calendar.")],
gr.Label(label="Is it a weekday?"),
examples=["2023-01-01", "2023-12-11"],
cache_examples=True,
title="Is it a weekday?")
if __name__ == "__main__":
demo.launch()
Calendar
Initialization
| name | type | default | description |
|---|---|---|---|
value |
str | datetime.datetime
|
None |
None |
type |
"string" | "datetime"
|
"datetime" |
None |
label |
str | None
|
None |
None |
info |
str | None
|
None |
None |
show_label |
bool | None
|
None |
None |
container |
bool
|
True |
None |
scale |
int | None
|
None |
None |
min_width |
int | None
|
None |
None |
interactive |
bool | None
|
None |
None |
visible |
bool
|
True |
None |
elem_id |
str | None
|
None |
None |
elem_classes |
list[str] | str | None
|
None |
None |
render |
bool
|
True |
None |
load_fn |
typing.Optional[typing.Callable[..., typing.Any]][
typing.Callable[..., typing.Any][Ellipsis, typing.Any],
None,
]
|
None |
None |
every |
float | None
|
None |
None |
Events
| name | description |
|---|---|
change |
|
input |
|
submit |
User function
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
- When used as an Input, the component only impacts the input signature of the user function.
- When used as an output, the component only impacts the return signature of the user function.
The code snippet below is accurate in cases where the component is used as both an input and an output.
- As output: Is passed, the preprocessed input data sent to the user's function in the backend.
- As input: Should return, the output data received by the component from the user's function in the backend.
def predict(
value: str | datetime.datetime | None
) -> str | datetime.datetime | None:
return value
Metadata
Release files for gradio-calendar 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gradio_calendar-0.0.6.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gradio_calendar-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.4 MB
Release files / gradio_calendar-0.0.6.tar.gz
| Download URL | gradio_calendar-0.0.6.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
728addfc07c350d46b69459447eb1e390d87ada0ddaed3457bd78da480eca2ec
|
|
BLAKE2b-256 checksum How to use checksums |
474a2103583da86778756f8b34de1054d08aba68728ed61a8708ed87c1f3ed17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / gradio_calendar-0.0.6-py3-none-any.whl
| Download URL | gradio_calendar-0.0.6-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2431b84ee2228be96770e907a478a4724cc36cc970a10e2b4209c85aa2373e2c
|
|
BLAKE2b-256 checksum How to use checksums |
f8e52bdb914682a1b1b82e9d0079e68f02e13ad7dc8103431e545688c5432547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|