adf0d17497
publish / version_or_publish (push) Waiting to run
storybook-build / changes (push) Waiting to run
storybook-build / :storybook-build (push) Blocked by required conditions
Sync Gradio Skills to Hugging Face / sync-skills (push) Waiting to run
functional / changes (push) Waiting to run
functional / build-frontend (push) Blocked by required conditions
functional / functional-test-SSR=false (push) Blocked by required conditions
functional / functional-reload (push) Blocked by required conditions
functional / functional-test-SSR=true (push) Blocked by required conditions
hygiene / hygiene-test (push) Waiting to run
python / changes (push) Waiting to run
python / build (push) Blocked by required conditions
python / test-ubuntu-latest-flaky (push) Blocked by required conditions
python / test-ubuntu-latest-not-flaky (push) Blocked by required conditions
python / test-windows-latest-flaky (push) Blocked by required conditions
python / test-windows-latest-not-flaky (push) Blocked by required conditions
js / changes (push) Waiting to run
js / js-test (push) Blocked by required conditions
docs-build / changes (push) Waiting to run
docs-build / docs-build (push) Blocked by required conditions
docs-build / website-build (push) Blocked by required conditions
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
from pathlib import Path
|
|
|
|
import gradio as gr
|
|
|
|
|
|
class TestModel3D:
|
|
def test_component_functions(self):
|
|
"""
|
|
get_config
|
|
"""
|
|
model_component = gr.components.Model3D(None, label="Model")
|
|
assert model_component.get_config() == {
|
|
"value": None,
|
|
"display_mode": None,
|
|
"clear_color": [0, 0, 0, 0],
|
|
"label": "Model",
|
|
"show_label": True,
|
|
"container": True,
|
|
"scale": None,
|
|
"min_width": 160,
|
|
"visible": True,
|
|
"elem_id": None,
|
|
"elem_classes": [],
|
|
"proxy_url": None,
|
|
"interactive": None,
|
|
"name": "model3d",
|
|
"camera_position": [None, None, None],
|
|
"height": None,
|
|
"zoom_speed": 1,
|
|
"pan_speed": 1,
|
|
"_selectable": False,
|
|
"key": None,
|
|
"preserved_by_key": ["value"],
|
|
"buttons": [],
|
|
}
|
|
|
|
file = "test/test_files/Box.gltf"
|
|
output1 = model_component.postprocess(file)
|
|
output2 = model_component.postprocess(Path(file))
|
|
assert output1
|
|
assert output2
|
|
assert Path(output1.path).name == Path(output2.path).name
|
|
|
|
def test_in_interface(self):
|
|
"""
|
|
Interface, process
|
|
"""
|
|
iface = gr.Interface(lambda x: x, "model3d", "model3d")
|
|
input_data = "test/test_files/Box.gltf"
|
|
output_data = iface(input_data)
|
|
assert output_data.endswith(".gltf")
|