Spaces:
Sleeping
Sleeping
Eachan Johnson
commited on
Commit
·
4d2787c
1
Parent(s):
4b68d5d
Fix latency issues
Browse files- README.md +1 -0
- app.py +30 -9
- requirements.txt +1 -1
README.md
CHANGED
@@ -4,6 +4,7 @@ emoji: 💊
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
|
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
---
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.44.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -117,7 +117,6 @@ def fit_to_data(
|
|
117 |
function_to_minimize,
|
118 |
x0=init_params,
|
119 |
jac=jacobian,
|
120 |
-
method='bfgs',
|
121 |
)
|
122 |
print(do)
|
123 |
return tuple(do.x.flatten())
|
@@ -315,10 +314,17 @@ with gr.Blocks() as demo:
|
|
315 |
|
316 |
# with gr.Row():
|
317 |
fit_message = gr.Markdown(parameter_msg, inputs=param_sliders)
|
318 |
-
plot = gr.Plot(
|
319 |
-
|
320 |
-
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
323 |
with gr.Tab("Forecasting the future!"):
|
324 |
gr.Markdown(
|
@@ -348,8 +354,23 @@ with gr.Blocks() as demo:
|
|
348 |
]
|
349 |
refresh_button_forecast = gr.Button("Update plot", scale=6)
|
350 |
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
-
demo.
|
|
|
117 |
function_to_minimize,
|
118 |
x0=init_params,
|
119 |
jac=jacobian,
|
|
|
120 |
)
|
121 |
print(do)
|
122 |
return tuple(do.x.flatten())
|
|
|
314 |
|
315 |
# with gr.Row():
|
316 |
fit_message = gr.Markdown(parameter_msg, inputs=param_sliders)
|
317 |
+
plot = gr.Plot(
|
318 |
+
label="Model fit",
|
319 |
+
scale=4,
|
320 |
+
)
|
321 |
+
gr.on(
|
322 |
+
triggers=[s.release for s in param_sliders] + [refresh_button.click],
|
323 |
+
fn=lambda *x: plot_data_altair(df=data, params=x),
|
324 |
+
inputs=param_sliders,
|
325 |
+
outputs=plot,
|
326 |
+
trigger_mode="once",
|
327 |
+
)
|
328 |
|
329 |
with gr.Tab("Forecasting the future!"):
|
330 |
gr.Markdown(
|
|
|
354 |
]
|
355 |
refresh_button_forecast = gr.Button("Update plot", scale=6)
|
356 |
|
357 |
+
param_and_forecast_sliders = param_sliders + forecast_sliders
|
358 |
+
fit_message = gr.Markdown(forecast_msg, inputs=param_and_forecast_sliders)
|
359 |
+
forecast = gr.Plot(
|
360 |
+
label="Forecast",
|
361 |
+
scale=4,
|
362 |
+
)
|
363 |
+
gr.on(
|
364 |
+
triggers=[s.release for s in param_and_forecast_sliders] + [refresh_button_forecast.click, refresh_button.click],
|
365 |
+
fn=lambda *x: plot_data_forecast_altair(df=data, params=x),
|
366 |
+
inputs=param_and_forecast_sliders,
|
367 |
+
outputs=forecast,
|
368 |
+
trigger_mode="once",
|
369 |
+
)
|
370 |
+
|
371 |
+
(fit_button
|
372 |
+
.click(lambda *x: fit_to_data(data, init_params=x), inputs=param_sliders, outputs=param_sliders)
|
373 |
+
.then(lambda *x: plot_data_altair(df=data, params=x),inputs=param_sliders, outputs=plot)
|
374 |
+
.then(lambda *x: plot_data_forecast_altair(df=data, params=x),inputs=param_and_forecast_sliders, outputs=forecast))
|
375 |
|
376 |
+
demo.launch(share=True)
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
altair[all]
|
2 |
carabiner-tools[mpl]
|
3 |
-
gradio
|
4 |
numpy
|
5 |
openpyxl
|
6 |
pandas
|
|
|
1 |
altair[all]
|
2 |
carabiner-tools[mpl]
|
3 |
+
gradio==4.44
|
4 |
numpy
|
5 |
openpyxl
|
6 |
pandas
|