gradio-model4dgs


Namegradio-model4dgs JSON
Version 0.0.4 PyPI version JSON
download
home_pageNone
SummaryPython library for easily interacting with trained machine learning models
upload_time2024-05-09 09:11:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords gradio-custom-component gradio-template-fallback
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ---
title: gradio-model4dgs
colorFrom: purple
colorTo: yellow
sdk: gradio
sdk_version: 4.29.0
app_file: app.py
pinned: false
license: mit
---

# `gradio_model4dgs`
<a href="https://pypi.org/project/gradio_model4dgs/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_model4dgs"></a>  

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")

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

## `Model4DGS`

### Initialization

<table>
<thead>
<tr>
<th align="left">name</th>
<th align="left" style="width: 25%;">type</th>
<th align="left">default</th>
<th align="left">description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>value</code></td>
<td align="left" style="width: 25%;">

```python
str | Callable | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">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.</td>
</tr>

<tr>
<td align="left"><code>height</code></td>
<td align="left" style="width: 25%;">

```python
int | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">height of the model4DGS component, in pixels.</td>
</tr>

<tr>
<td align="left"><code>label</code></td>
<td align="left" style="width: 25%;">

```python
str | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>show_label</code></td>
<td align="left" style="width: 25%;">

```python
bool | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>every</code></td>
<td align="left" style="width: 25%;">

```python
float | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>container</code></td>
<td align="left" style="width: 25%;">

```python
bool
```

</td>
<td align="left"><code>True</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>scale</code></td>
<td align="left" style="width: 25%;">

```python
int | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>min_width</code></td>
<td align="left" style="width: 25%;">

```python
int
```

</td>
<td align="left"><code>160</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>interactive</code></td>
<td align="left" style="width: 25%;">

```python
bool | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>visible</code></td>
<td align="left" style="width: 25%;">

```python
bool
```

</td>
<td align="left"><code>True</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>elem_id</code></td>
<td align="left" style="width: 25%;">

```python
str | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>elem_classes</code></td>
<td align="left" style="width: 25%;">

```python
list[str] | str | None
```

</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>

<tr>
<td align="left"><code>render</code></td>
<td align="left" style="width: 25%;">

```python
bool
```

</td>
<td align="left"><code>True</code></td>
<td align="left">None</td>
</tr>
</tbody></table>


### 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.

 ```python
 def predict(
     value: List[str] | None
 ) -> List[str] | str | None:
     return value
 ```
 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gradio-model4dgs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "gradio-custom-component, gradio-template-Fallback",
    "author": null,
    "author_email": "Zhang Chi <chi.zhang.helen@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c6/93/7adb29135c1561ed4fa75f324e8a98983c2371b4914022e8519e69f7c90a/gradio_model4dgs-0.0.4.tar.gz",
    "platform": null,
    "description": "---\ntitle: gradio-model4dgs\ncolorFrom: purple\ncolorTo: yellow\nsdk: gradio\nsdk_version: 4.29.0\napp_file: app.py\npinned: false\nlicense: mit\n---\n\n# `gradio_model4dgs`\n<a href=\"https://pypi.org/project/gradio_model4dgs/\" target=\"_blank\"><img alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/gradio_model4dgs\"></a>  \n\nPython library for easily interacting with trained machine learning models\n\n## Installation\n\n```bash\npip install gradio_model4dgs\n```\n\n## Usage\n\n```python\nimport gradio as gr\nfrom gradio_model4dgs import Model4DGS\nimport os\n\nimage_dir = os.path.join(os.path.dirname(__file__), \"assets\")\n\nif os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):\n    examples = [os.path.join(image_dir, file) for file in os.listdir(image_dir)]\nelse:\n    examples = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]\n\nwith gr.Blocks() as demo:\n    with gr.Row():\n        Model4DGS(value=examples, label=\"4D Model\")\n\nif __name__ == \"__main__\":\n    demo.launch(share=True)\n```\n\n## `Model4DGS`\n\n### Initialization\n\n<table>\n<thead>\n<tr>\n<th align=\"left\">name</th>\n<th align=\"left\" style=\"width: 25%;\">type</th>\n<th align=\"left\">default</th>\n<th align=\"left\">description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\"><code>value</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nstr | Callable | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">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.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>height</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nint | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">height of the model4DGS component, in pixels.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>label</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nstr | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>show_label</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>every</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nfloat | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>container</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool\n```\n\n</td>\n<td align=\"left\"><code>True</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>scale</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nint | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>min_width</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nint\n```\n\n</td>\n<td align=\"left\"><code>160</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>interactive</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>visible</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool\n```\n\n</td>\n<td align=\"left\"><code>True</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>elem_id</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nstr | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>elem_classes</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nlist[str] | str | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>render</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool\n```\n\n</td>\n<td align=\"left\"><code>True</code></td>\n<td align=\"left\">None</td>\n</tr>\n</tbody></table>\n\n\n### Events\n\n| name | description |\n|:-----|:------------|\n| `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. |\n| `upload` | This listener is triggered when the user uploads a file into the Model4DGS. |\n| `edit` | This listener is triggered when the user edits the Model4DGS (e.g. image) using the built-in editor. |\n| `clear` | This listener is triggered when the user clears the Model4DGS using the X button for the component. |\n\n\n\n### User function\n\nThe impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).\n\n- When used as an Input, the component only impacts the input signature of the user function.\n- When used as an output, the component only impacts the return signature of the user function.\n\nThe code snippet below is accurate in cases where the component is used as both an input and an output.\n\n- **As output:** Is passed, the preprocessed input data sent to the user's function in the backend.\n- **As input:** Should return, the output data received by the component from the user's function in the backend.\n\n ```python\n def predict(\n     value: List[str] | None\n ) -> List[str] | str | None:\n     return value\n ```\n \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for easily interacting with trained machine learning models",
    "version": "0.0.4",
    "project_urls": null,
    "split_keywords": [
        "gradio-custom-component",
        " gradio-template-fallback"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79ba94119e078c3a4dc3e8829e2721e0726f48c6881ffa2c9bb9051bfea6bfc5",
                "md5": "2db004aafeae6ff64555c556156b92dd",
                "sha256": "a17ebfd89d0b297126943159406b23bd3cda3dff67a18958b9968fd659a20409"
            },
            "downloads": -1,
            "filename": "gradio_model4dgs-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2db004aafeae6ff64555c556156b92dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 219597,
            "upload_time": "2024-05-09T09:11:24",
            "upload_time_iso_8601": "2024-05-09T09:11:24.796477Z",
            "url": "https://files.pythonhosted.org/packages/79/ba/94119e078c3a4dc3e8829e2721e0726f48c6881ffa2c9bb9051bfea6bfc5/gradio_model4dgs-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6937adb29135c1561ed4fa75f324e8a98983c2371b4914022e8519e69f7c90a",
                "md5": "b0a3ab5746a262b719c0b80a1223d67b",
                "sha256": "c11845c2b1c47f340a4a6ce0174a050f57f422ebb465cd0d4cd557b6c71e1233"
            },
            "downloads": -1,
            "filename": "gradio_model4dgs-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "b0a3ab5746a262b719c0b80a1223d67b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8260510,
            "upload_time": "2024-05-09T09:11:29",
            "upload_time_iso_8601": "2024-05-09T09:11:29.126431Z",
            "url": "https://files.pythonhosted.org/packages/c6/93/7adb29135c1561ed4fa75f324e8a98983c2371b4914022e8519e69f7c90a/gradio_model4dgs-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-09 09:11:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gradio-model4dgs"
}
        
Elapsed time: 0.24810s