Spaces:
Sleeping
Sleeping
import gradio as gr | |
import numpy as np | |
def branin(x1, x2): | |
y = float( | |
(x2 - 5.1 / (4 * np.pi**2) * x1**2 + 5.0 / np.pi * x1 - 6.0) ** 2 | |
+ 10 * (1 - 1.0 / (8 * np.pi)) * np.cos(x1) | |
+ 10 | |
) | |
return y | |
iface = gr.Interface( | |
fn=branin, | |
inputs=[ | |
gr.Number(0.25, label="x1", minimum=0.0, maximum=1.0), | |
gr.Number(0.75, label="x2", minimum=0.0, maximum=1.0), | |
], | |
outputs=gr.Number(label="branin function value"), | |
) | |
iface.launch() | |