Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,4 +54,22 @@ with gr.Blocks() as demo:
|
|
54 |
|
55 |
fig, ax = plt.subplots(figsize=(6, 3))
|
56 |
ax.plot(df["Timestamp"], df["Risk_Num"], marker="o", linestyle="-", color="red")
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
fig, ax = plt.subplots(figsize=(6, 3))
|
56 |
ax.plot(df["Timestamp"], df["Risk_Num"], marker="o", linestyle="-", color="red")
|
57 |
+
ax.set_ylim(0.5, 3.5)
|
58 |
+
ax.set_yticks([1, 2, 3])
|
59 |
+
ax.set_yticklabels(['Low', 'Moderate', 'High'])
|
60 |
+
ax.set_title("Risk Level Over Time")
|
61 |
+
ax.set_xlabel("Timestamp")
|
62 |
+
ax.set_ylabel("Risk Level")
|
63 |
+
ax.tick_params(axis='x', rotation=45)
|
64 |
+
plt.tight_layout()
|
65 |
+
|
66 |
+
df_display = df[["Temperature", "Duration", "Risk", "Timestamp"]]
|
67 |
+
|
68 |
+
return risk, alert_msg, timestamp, summary_md, df_display, fig
|
69 |
+
|
70 |
+
predict_btn.click(classify, inputs=[temp, duration],
|
71 |
+
outputs=[result, alert, ist_time, summary, history_table, plot])
|
72 |
+
|
73 |
+
retrain_btn.click(retrain_model, outputs=[retrain_output])
|
74 |
+
|
75 |
+
demo.launch()
|