Spaces:
Sleeping
Sleeping
Lennard Schober
commited on
Commit
·
c188d2e
1
Parent(s):
08bc7ab
Add responsiveness for mobile
Browse files
app.py
CHANGED
|
@@ -102,6 +102,7 @@ def plot_heat_equation(m, approx_type):
|
|
| 102 |
yaxis_title="t",
|
| 103 |
zaxis_title="u",
|
| 104 |
),
|
|
|
|
| 105 |
)
|
| 106 |
|
| 107 |
# Config to remove modebar buttons except the save image button
|
|
@@ -206,6 +207,7 @@ def plot_errors(m, approx_type):
|
|
| 206 |
yaxis_title="t",
|
| 207 |
zaxis_title="u",
|
| 208 |
),
|
|
|
|
| 209 |
)
|
| 210 |
|
| 211 |
# Config to remove modebar buttons except the save image button
|
|
@@ -326,8 +328,6 @@ def train_coefficients(m, kernel):
|
|
| 326 |
# Generate data
|
| 327 |
a_train, u_train, x, t = generate_data()
|
| 328 |
|
| 329 |
-
print("in train coeffs: ", glob_k)
|
| 330 |
-
|
| 331 |
# Define random features
|
| 332 |
theta = np.column_stack(
|
| 333 |
(
|
|
@@ -364,8 +364,6 @@ def plot_function(k, a, b, c):
|
|
| 364 |
|
| 365 |
glob_k, glob_a, glob_b, glob_c = k, a, b, c
|
| 366 |
|
| 367 |
-
print(glob_k, k)
|
| 368 |
-
|
| 369 |
x = np.linspace(0, 1, 100)
|
| 370 |
t = np.linspace(0, 5, 500)
|
| 371 |
X, T = np.meshgrid(x, t) # Create the mesh grid
|
|
@@ -532,8 +530,10 @@ def create_gradio_ui():
|
|
| 532 |
approx_button = gr.Button("Plot Approximation")
|
| 533 |
|
| 534 |
with gr.Row():
|
| 535 |
-
|
| 536 |
-
|
|
|
|
|
|
|
| 537 |
|
| 538 |
approx_button.click(
|
| 539 |
fn=plot_all,
|
|
|
|
| 102 |
yaxis_title="t",
|
| 103 |
zaxis_title="u",
|
| 104 |
),
|
| 105 |
+
margin=dict(l=0, r=0, t=0, b=0), # Reduce margins
|
| 106 |
)
|
| 107 |
|
| 108 |
# Config to remove modebar buttons except the save image button
|
|
|
|
| 207 |
yaxis_title="t",
|
| 208 |
zaxis_title="u",
|
| 209 |
),
|
| 210 |
+
margin=dict(l=0, r=0, t=0, b=0), # Reduce margins
|
| 211 |
)
|
| 212 |
|
| 213 |
# Config to remove modebar buttons except the save image button
|
|
|
|
| 328 |
# Generate data
|
| 329 |
a_train, u_train, x, t = generate_data()
|
| 330 |
|
|
|
|
|
|
|
| 331 |
# Define random features
|
| 332 |
theta = np.column_stack(
|
| 333 |
(
|
|
|
|
| 364 |
|
| 365 |
glob_k, glob_a, glob_b, glob_c = k, a, b, c
|
| 366 |
|
|
|
|
|
|
|
| 367 |
x = np.linspace(0, 1, 100)
|
| 368 |
t = np.linspace(0, 5, 500)
|
| 369 |
X, T = np.meshgrid(x, t) # Create the mesh grid
|
|
|
|
| 530 |
approx_button = gr.Button("Plot Approximation")
|
| 531 |
|
| 532 |
with gr.Row():
|
| 533 |
+
with gr.Column(scale=1):
|
| 534 |
+
approx_plot = gr.Plot(visible=False)
|
| 535 |
+
with gr.Column(scale=1):
|
| 536 |
+
error_plot = gr.Plot(visible=False)
|
| 537 |
|
| 538 |
approx_button.click(
|
| 539 |
fn=plot_all,
|