---
title: gradio-model4dgs
colorFrom: purple
colorTo: yellow
sdk: gradio
sdk_version: 4.29.0
app_file: app.py
pinned: false
license: mit
---
# `gradio_model4dgs`
Python library for easily interacting with trained machine learning models
## Installation
```bash
pip install gradio_model4dgs
```
## Usage
```python
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 |
```python 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 |
```python float ``` | 8 |
None |
height |
```python int | None ``` | None |
height of the model4DGS component, in pixels. |
label |
```python str | None ``` | None |
None |
show_label |
```python bool | None ``` | None |
None |
every |
```python float | None ``` | None |
None |
container |
```python bool ``` | True |
None |
scale |
```python int | None ``` | None |
None |
min_width |
```python int ``` | 160 |
None |
interactive |
```python bool | None ``` | None |
None |
visible |
```python bool ``` | True |
None |
elem_id |
```python str | None ``` | None |
None |
elem_classes |
```python list[str] | str | None ``` | None |
None |
render |
```python bool ``` | True |
None |