Skip to main content

Python library for easily interacting with trained machine learning models

Project description


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", fps=8)

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

Model4DGS

Initialization

name type default description
value
str | Callable | None
None path 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.
fps
float
8 None
height
int | None
None height of the model4DGS component, in pixels.
label
str | None
None None
show_label
bool | None
None None
every
float | None
None None
container
bool
True None
scale
int | None
None None
min_width
int
160 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

Events

name description
change Triggered 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.
upload This listener is triggered when the user uploads a file into the Model4DGS.
edit This listener is triggered when the user edits the Model4DGS (e.g. image) using the built-in editor.
clear This 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gradio_model4dgs-0.0.5.tar.gz (10.5 MB view details)

Uploaded Source

Built Distribution

gradio_model4dgs-0.0.5-py3-none-any.whl (219.7 kB view details)

Uploaded Python 3

File details

Details for the file gradio_model4dgs-0.0.5.tar.gz.

File metadata

  • Download URL: gradio_model4dgs-0.0.5.tar.gz
  • Upload date:
  • Size: 10.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for gradio_model4dgs-0.0.5.tar.gz
Algorithm Hash digest
SHA256 13c9184aef6441a47c0ac4d840572932ad49f5863f2a557c9a332cdb68240dff
MD5 abb545b9fb0440ae99f05e41d510e543
BLAKE2b-256 71d3f95cad98c3c510616e6d0da5b260f5782a4ed031684a4824be69cae71e78

See more details on using hashes here.

File details

Details for the file gradio_model4dgs-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for gradio_model4dgs-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8aca3f956e3cb5e9b17d13167b52e6cb84a88aacc1709e881145b4a08dcfc7f1
MD5 8104251daf5a7afb9cad8015bb32f101
BLAKE2b-256 188a280837cba3707b7870121d2d971ea7883046dda645effca9266687957940

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page