Download app.py from AccelerationConsortium/TransferLearning4D: direct link, hf CLI and curl.
- Browser
- Download file 702 Bytes
-
https://huggingface.co/spaces/AccelerationConsortium/TransferLearning4D/resolve/main/app.py
- Command line
-
hf download hf://spaces/AccelerationConsortium/TransferLearning4D/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AccelerationConsortium/TransferLearning4D/resolve/main/app.py
702 Bytes
| import gradio as gr | |
| from botorch.test_functions.synthetic import Hartmann | |
| from torch import Tensor | |
| def hartmann(x1, x2, x3, x4): | |
| x_tensor = Tensor((x1, x2, x3, x4)) | |
| hartmann_function = Hartmann(dim=4) | |
| y = hartmann_function(x_tensor) | |
| return float(y) | |
| iface = gr.Interface( | |
| fn=hartmann, | |
| inputs=[ | |
| gr.Number(0.33, label="x1", minimum=0.0, maximum=1.0), | |
| gr.Number(0.33, label="x2", minimum=0.0, maximum=1.0), | |
| gr.Number(0.33, label="x3", minimum=0.0, maximum=1.0), | |
| gr.Number(0.33, label="x4", minimum=0.0, maximum=1.0), | |
| ], | |
| outputs=gr.Number( | |
| hartmann(0.33, 0.33, 0.33, 0.33), label="Hartmann function value" | |
| ), | |
| ) | |
| iface.launch() | |