Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
gradio_toggle
A custom Gradio component that toggles between on and off states.
pip install gradio_toggle
# Toggle - A Gradio Custom Component
# Created by Daniel Ialcin Misser Westergaard
# https://huggingface.co/dwancin
# https://github.com/dwancin
# (c) 2024
import gradio as gr
from gradio_toggle import Toggle
def update_toggle_state(input_component):
print(f"Updating toggle: {input_component}")
return input_component
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
input_component = Toggle()
with gr.Column():
output_component = Toggle(color="red", info="this is the output", show_label=False, interactive=False, radius="sm", transition=1)
input_component.change(fn=update_toggle_state, inputs=input_component, outputs=output_component)
if __name__ == '__main__':
demo.launch()
Toggle
name | type | default | description |
---|---|---|---|
value |
| False | |
label |
| None | |
info |
| None | |
color |
| None | |
radius |
| "lg" | |
transition |
| 0.3 | |
every |
| None | |
inputs |
| None | None |
show_label |
| None | |
container |
| True | |
scale |
| None | |
min_width |
| 160 | |
interactive |
| None | |
visible |
| True | |
elem_id |
| None | |
elem_classes |
| None | |
render |
| True | |
key |
| None |
name | description |
---|---|
change | Triggered when the value of the Toggle changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See .input() for a listener that is only triggered by user input. |
input | This listener is triggered when the user changes the value of the Toggle. |
select | Event listener for when the user selects or deselects the Toggle. Uses event data gradio.SelectData to carry value referring to the label of the Toggle, and selected to refer to state of the Toggle. See EventData documentation on how to use this event data |
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).
The code snippet below is accurate in cases where the component is used as both an input and an output.
def predict(
value: bool | None
) -> bool | None:
return value
FAQs
A custom Gradio component that toggles between on and off states.
We found that gradio-toggle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.