Spaces:
Runtime error
Runtime error
again
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ import pytz
|
|
| 10 |
import pandas as pd
|
| 11 |
import plotly.tools as tls
|
| 12 |
import plotly.io as pio
|
|
|
|
| 13 |
|
| 14 |
HOST = os.environ.get("host")
|
| 15 |
PORT = int(os.environ.get("port"))
|
|
@@ -689,11 +690,9 @@ def get_data_default(time_scale, exp):
|
|
| 689 |
df = pd.DataFrame(temp_graph)
|
| 690 |
df = df.set_index("x")
|
| 691 |
|
| 692 |
-
fig =
|
| 693 |
-
plot1 = pio.to_json(fig)
|
| 694 |
-
plt.close()
|
| 695 |
else:
|
| 696 |
-
|
| 697 |
|
| 698 |
if od_graph is not None:
|
| 699 |
for od in od_graph:
|
|
@@ -705,11 +704,9 @@ def get_data_default(time_scale, exp):
|
|
| 705 |
df = pd.DataFrame(od_graph)
|
| 706 |
df = df.set_index("x")
|
| 707 |
|
| 708 |
-
|
| 709 |
-
plot2 = pio.to_json(fig)
|
| 710 |
-
plt.close()
|
| 711 |
else:
|
| 712 |
-
|
| 713 |
|
| 714 |
if norm_od_graph is not None:
|
| 715 |
for od in norm_od_graph:
|
|
@@ -721,11 +718,9 @@ def get_data_default(time_scale, exp):
|
|
| 721 |
df = pd.DataFrame(norm_od_graph)
|
| 722 |
df = df.set_index("x")
|
| 723 |
|
| 724 |
-
|
| 725 |
-
plot3 = pio.to_json(fig)
|
| 726 |
-
plt.close()
|
| 727 |
else:
|
| 728 |
-
|
| 729 |
|
| 730 |
if growth_rate_graph is not None:
|
| 731 |
for gr in growth_rate_graph:
|
|
@@ -737,13 +732,11 @@ def get_data_default(time_scale, exp):
|
|
| 737 |
df = pd.DataFrame(growth_rate_graph)
|
| 738 |
df = df.set_index("x")
|
| 739 |
|
| 740 |
-
|
| 741 |
-
plot4 = pio.to_json(fig)
|
| 742 |
-
plt.close()
|
| 743 |
else:
|
| 744 |
-
|
| 745 |
|
| 746 |
-
return
|
| 747 |
|
| 748 |
|
| 749 |
# Define the interface components
|
|
|
|
| 10 |
import pandas as pd
|
| 11 |
import plotly.tools as tls
|
| 12 |
import plotly.io as pio
|
| 13 |
+
import plotly.graph_objects as go
|
| 14 |
|
| 15 |
HOST = os.environ.get("host")
|
| 16 |
PORT = int(os.environ.get("port"))
|
|
|
|
| 690 |
df = pd.DataFrame(temp_graph)
|
| 691 |
df = df.set_index("x")
|
| 692 |
|
| 693 |
+
fig = go.Figure(data=go.Scatter(x=df.index, y=df["temperature"], mode="lines"))
|
|
|
|
|
|
|
| 694 |
else:
|
| 695 |
+
fig = None
|
| 696 |
|
| 697 |
if od_graph is not None:
|
| 698 |
for od in od_graph:
|
|
|
|
| 704 |
df = pd.DataFrame(od_graph)
|
| 705 |
df = df.set_index("x")
|
| 706 |
|
| 707 |
+
fig1 = go.Figure(data=go.Scatter(x=df.index, y=df["od"], mode="lines"))
|
|
|
|
|
|
|
| 708 |
else:
|
| 709 |
+
fig1 = None
|
| 710 |
|
| 711 |
if norm_od_graph is not None:
|
| 712 |
for od in norm_od_graph:
|
|
|
|
| 718 |
df = pd.DataFrame(norm_od_graph)
|
| 719 |
df = df.set_index("x")
|
| 720 |
|
| 721 |
+
fig2 = go.Figure(data=go.Scatter(x=df.index, y=df["normalized_od"], mode="lines"))
|
|
|
|
|
|
|
| 722 |
else:
|
| 723 |
+
fig2 = None
|
| 724 |
|
| 725 |
if growth_rate_graph is not None:
|
| 726 |
for gr in growth_rate_graph:
|
|
|
|
| 732 |
df = pd.DataFrame(growth_rate_graph)
|
| 733 |
df = df.set_index("x")
|
| 734 |
|
| 735 |
+
fig3 = go.Figure(data=go.Scatter(x=df.index, y=df["growth_rate"], mode="lines"))
|
|
|
|
|
|
|
| 736 |
else:
|
| 737 |
+
fig3 = None
|
| 738 |
|
| 739 |
+
return fig, fig1, fig2, fig3
|
| 740 |
|
| 741 |
|
| 742 |
# Define the interface components
|