Socket
Socket
Sign inDemoInstall

gradio-model4dgs

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gradio-model4dgs

Python library for easily interacting with trained machine learning models


Maintainers
1

Readme


title: gradio-model4dgs colorFrom: purple colorTo: yellow sdk: gradio sdk_version: 4.29.0 app_file: app.py pinned: false license: mit

gradio_model4dgs

PyPI - Version

Python library for easily interacting with trained machine learning models

Installation

pip install gradio_model4dgs

Usage

import gradio as gr
from gradio_model4dgs import Model4DGS
import os

image_dir = os.path.join(os.path.dirname(__file__), "assets")

if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
    examples = [os.path.join(image_dir, file) for file in os.listdir(image_dir)]
else:
    examples = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]

with gr.Blocks() as demo:
    with gr.Row():
        Model4DGS(value=examples, label="4D Model")

if __name__ == "__main__":
    demo.launch(share=True)

Model4DGS

Initialization

nametypedefaultdescription
value
str | Callable | None
Nonepath to (.splat) file to show in model4DGS viewer. If callable, the function will be called whenever the app loads to set the initial value of the component.
height
int | None
Noneheight of the model4DGS component, in pixels.
label
str | None
NoneNone
show_label
bool | None
NoneNone
every
float | None
NoneNone
container
bool
TrueNone
scale
int | None
NoneNone
min_width
int
160None
interactive
bool | None
NoneNone
visible
bool
TrueNone
elem_id
str | None
NoneNone
elem_classes
list[str] | str | None
NoneNone
render
bool
TrueNone

Events

namedescription
changeTriggered when the value of the Model4DGS 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.
uploadThis listener is triggered when the user uploads a file into the Model4DGS.
editThis listener is triggered when the user edits the Model4DGS (e.g. image) using the built-in editor.
clearThis listener is triggered when the user clears the Model4DGS using the X button for the component.

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: List[str] | None
) -> List[str] | str | None:
    return value

Keywords

FAQs


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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc