You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP โ†’
Socket
Book a DemoInstallSign in
Socket

gradio-calendar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gradio-calendar

Gradio component for selecting dates with a calendar ๐Ÿ“†

0.0.6
pipPyPI
Maintainers
1

gradio_calendar

PyPI - Version Static Badge Static Badge

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

nametypedefaultdescription
value
str | datetime.datetime
NoneNone
type
"string" | "datetime"
"datetime"None
label
str | None
NoneNone
info
str | None
NoneNone
show_label
bool | None
NoneNone
container
bool
TrueNone
scale
int | None
NoneNone
min_width
int | None
NoneNone
interactive
bool | None
NoneNone
visible
bool
TrueNone
elem_id
str | None
NoneNone
elem_classes
list[str] | str | None
NoneNone
render
bool
TrueNone
load_fn
typing.Optional[typing.Callable[..., typing.Any]][
    typing.Callable[..., typing.Any][Ellipsis, typing.Any],
    None,
]
NoneNone
every
float | None
NoneNone

Events

namedescription
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

Keywords

calendar

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts