UCS2014 commited on
Commit
105c522
·
verified ·
1 Parent(s): a15ee43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -36
app.py CHANGED
@@ -24,17 +24,25 @@ MODEL_FALLBACKS = [MODELS_DIR / "model.joblib", MODELS_DIR / "model.pkl"]
24
  COLORS = {"pred": "#1f77b4", "actual": "#f2b702", "ref": "#5a5a5a"}
25
 
26
  # ---- Plot sizing controls (edit here) ----
27
- CROSS_W = 500; CROSS_H = 500 # square cross-plot (Build + Validate)
28
  TRACK_W = 400; TRACK_H = 950 # log-strip style (all pages)
29
  FONT_SZ = 15
30
  PLOT_COLS = [30, 1, 20] # 3-column band: left • spacer • right (Build + Validate)
31
- CROSS_NUDGE = 0.06 # push cross-plot to the RIGHT inside its band:
32
  # inner columns [CROSS_NUDGE : 1] → bigger = more right
33
 
34
  # =========================
35
  # Page / CSS
36
  # =========================
37
  st.set_page_config(page_title="ST_GeoMech_UCS", page_icon="logo.png", layout="wide")
 
 
 
 
 
 
 
 
38
  st.markdown("<style>header, footer{visibility:hidden !important;}</style>", unsafe_allow_html=True)
39
  st.markdown(
40
  """
@@ -173,7 +181,9 @@ def cross_plot(actual, pred):
173
 
174
  fixed_min = 6000
175
  fixed_max = 10000
176
-
 
 
177
  fig = go.Figure()
178
 
179
  # Scatter points
@@ -185,11 +195,11 @@ def cross_plot(actual, pred):
185
  ))
186
 
187
  # 1:1 reference line from bottom-left to top-right
188
- fig.add_trace(go.Scatter(
189
- x=[fixed_min, fixed_max], y=[fixed_min, fixed_max], mode="lines",
190
- line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
191
- hoverinfo="skip", showlegend=False
192
- ))
193
 
194
  fig.update_layout(
195
  width=CROSS_W, height=CROSS_H,
@@ -200,24 +210,28 @@ def cross_plot(actual, pred):
200
  dragmode=False # disables zooming
201
  )
202
 
203
- fig.update_xaxes(
204
- title_text="<b>Actual UCS (psi)</b>",
205
- range=[fixed_min, fixed_max],
206
- tickformat=",.0f", ticks="outside",
207
- showline=True, linewidth=1.2, linecolor="#444", mirror=True,
208
- showgrid=True, gridcolor="rgba(0,0,0,0.12)",
209
- automargin=True, fixedrange=True # disables zooming
210
- )
 
 
211
 
212
- fig.update_yaxes(
213
- title_text="<b>Predicted UCS (psi)</b>",
214
- range=[fixed_min, fixed_max],
215
- tickformat=",.0f", ticks="outside",
216
- showline=True, linewidth=1.2, linecolor="#444", mirror=True,
217
- showgrid=True, gridcolor="rgba(0,0,0,0.12)",
218
- scaleanchor="x", scaleratio=1,
219
- automargin=True, fixedrange=True # disables zooming
220
- )
 
 
221
 
222
  return fig
223
 
@@ -276,7 +290,7 @@ def track_plot(df, include_actual=True):
276
 
277
  fig.update_xaxes(
278
  title_text="<b>UCS (psi)</b>",
279
- title_font=dict(size=16),
280
  side="top", range=[xmin, xmax],
281
  ticks="outside", tickformat=",.0f",
282
  tickmode="auto", tick0=tick0,
@@ -286,22 +300,13 @@ def track_plot(df, include_actual=True):
286
 
287
  fig.update_yaxes(
288
  title_text=f"<b>{ylab}</b>",
289
- title_font=dict(size=16),
290
  range=y_range,
291
  ticks="outside",
292
  showline=True, linewidth=1.2, linecolor="#444", mirror=True,
293
  showgrid=True, gridcolor="rgba(0,0,0,0.12)", automargin=True
294
  )
295
 
296
- # Add a border rectangle to enclose the full figure space
297
- fig.add_shape(
298
- type="rect",
299
- xref="paper", yref="paper",
300
- x0=-0.12, y0=-0.20, x1=1.12, y1=1.12,
301
- line=dict(color="#000", width=1.5),
302
- layer="below"
303
- )
304
-
305
  return fig
306
 
307
 
 
24
  COLORS = {"pred": "#1f77b4", "actual": "#f2b702", "ref": "#5a5a5a"}
25
 
26
  # ---- Plot sizing controls (edit here) ----
27
+ CROSS_W = 450; CROSS_H = 450 # square cross-plot (Build + Validate)
28
  TRACK_W = 400; TRACK_H = 950 # log-strip style (all pages)
29
  FONT_SZ = 15
30
  PLOT_COLS = [30, 1, 20] # 3-column band: left • spacer • right (Build + Validate)
31
+ CROSS_NUDGE = 0.02 # push cross-plot to the RIGHT inside its band:
32
  # inner columns [CROSS_NUDGE : 1] → bigger = more right
33
 
34
  # =========================
35
  # Page / CSS
36
  # =========================
37
  st.set_page_config(page_title="ST_GeoMech_UCS", page_icon="logo.png", layout="wide")
38
+ st.markdown("""
39
+ <style>
40
+ /* Hide the drag and drop text helper */
41
+ section[data-testid="stFileUploader"] > div > div:first-child {
42
+ display: none;
43
+ }
44
+ </style>
45
+ """, unsafe_allow_html=True)
46
  st.markdown("<style>header, footer{visibility:hidden !important;}</style>", unsafe_allow_html=True)
47
  st.markdown(
48
  """
 
181
 
182
  fixed_min = 6000
183
  fixed_max = 10000
184
+ # Choose tick spacing and first tick
185
+ tick_spacing = 500
186
+ tick_start = 6000
187
  fig = go.Figure()
188
 
189
  # Scatter points
 
195
  ))
196
 
197
  # 1:1 reference line from bottom-left to top-right
198
+ fig.add_trace(go.Scatter(
199
+ x=[x0, x1], y=[x0, x1], mode="lines",
200
+ line=dict(color=COLORS["ref"], width=1.2, dash="dash"),
201
+ hoverinfo="skip", showlegend=False
202
+ ))
203
 
204
  fig.update_layout(
205
  width=CROSS_W, height=CROSS_H,
 
210
  dragmode=False # disables zooming
211
  )
212
 
213
+ fig.update_xaxes(
214
+ title_text="<b>Actual UCS (psi)</b>",
215
+ title_font=dict(size=18, family="Arial", color="#000"),
216
+ range=[x0, x1],
217
+ tick0=tick_start,
218
+ dtick=tick_spacing,
219
+ ticks="outside", tickformat=",.0f",
220
+ showline=True, linewidth=1.2, linecolor="#444", mirror=True,
221
+ showgrid=True, gridcolor="rgba(0,0,0,0.12)", automargin=True
222
+ )
223
 
224
+ fig.update_yaxes(
225
+ title_text="<b>Predicted UCS (psi)</b>",
226
+ title_font=dict(size=18, family="Arial", color="#000"),
227
+ range=[x0, x1],
228
+ tick0=tick_start,
229
+ dtick=tick_spacing,
230
+ ticks="outside", tickformat=",.0f",
231
+ showline=True, linewidth=1.2, linecolor="#444", mirror=True,
232
+ showgrid=True, gridcolor="rgba(0,0,0,0.12)",
233
+ scaleanchor="x", scaleratio=1, automargin=True
234
+ )
235
 
236
  return fig
237
 
 
290
 
291
  fig.update_xaxes(
292
  title_text="<b>UCS (psi)</b>",
293
+ title_font=dict(size=18, family="Arial", color="#000"),
294
  side="top", range=[xmin, xmax],
295
  ticks="outside", tickformat=",.0f",
296
  tickmode="auto", tick0=tick0,
 
300
 
301
  fig.update_yaxes(
302
  title_text=f"<b>{ylab}</b>",
303
+ title_font=dict(size=18, family="Arial", color="#000"),
304
  range=y_range,
305
  ticks="outside",
306
  showline=True, linewidth=1.2, linecolor="#444", mirror=True,
307
  showgrid=True, gridcolor="rgba(0,0,0,0.12)", automargin=True
308
  )
309
 
 
 
 
 
 
 
 
 
 
310
  return fig
311
 
312