Levin-Aleksey commited on
Commit
5e60596
·
1 Parent(s): 129b1de
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -135,24 +135,15 @@ if df_cohorts.empty:
135
  daily_map_raw = data.get("txs_per_day_by_cohorts", {})
136
  df_cohorts = cohorts_from_daily_map(daily_map_raw)
137
 
 
 
138
  if df_cohorts.empty:
139
  st.warning("Нет данных для графика: users_by_cohorts и txs_per_day_by_cohorts пустые или невалидные.")
140
  else:
141
- st.caption("Native chart (always on)")
142
- st.area_chart(df_cohorts, x="cohort_day", y="user_count", height=400)
143
-
144
- try:
145
- st.caption("Plotly chart")
146
- fig = px.area(df_cohorts, x="cohort_day", y="user_count", template="plotly")
147
- fig.update_layout(height=400, margin=dict(l=20, r=20, t=20, b=20))
148
- st.plotly_chart(fig)
149
- except Exception as exc:
150
- st.warning(f"Plotly не отрисован: {exc}")
151
-
152
- if IS_HF_SPACE:
153
- st.caption("HF mode: fallback enabled")
154
 
155
- st.caption("Server-rendered fallback (matplotlib)")
156
  mpl_fig, mpl_ax = plt.subplots(figsize=(9, 4))
157
  mpl_ax.plot(df_cohorts["cohort_day"], df_cohorts["user_count"], linewidth=2)
158
  mpl_ax.fill_between(df_cohorts["cohort_day"], df_cohorts["user_count"], alpha=0.25)
@@ -162,6 +153,17 @@ else:
162
  st.pyplot(mpl_fig)
163
  plt.close(mpl_fig)
164
 
 
 
 
 
 
 
 
 
 
 
 
165
  st.caption("Chart debug")
166
  st.metric("Rows", len(df_cohorts))
167
  st.metric("Min day", int(df_cohorts["cohort_day"].min()))
 
135
  daily_map_raw = data.get("txs_per_day_by_cohorts", {})
136
  df_cohorts = cohorts_from_daily_map(daily_map_raw)
137
 
138
+ st.info(f"🔍 Debug Info: DataFrame is empty? {df_cohorts.empty} | Shape: {df_cohorts.shape}")
139
+
140
  if df_cohorts.empty:
141
  st.warning("Нет данных для графика: users_by_cohorts и txs_per_day_by_cohorts пустые или невалидные.")
142
  else:
143
+ st.caption("1. Table Data (Guaranteed Fallback)")
144
+ st.table(df_cohorts.head(10))
 
 
 
 
 
 
 
 
 
 
 
145
 
146
+ st.caption("2. Server-rendered fallback (matplotlib - No JS required)")
147
  mpl_fig, mpl_ax = plt.subplots(figsize=(9, 4))
148
  mpl_ax.plot(df_cohorts["cohort_day"], df_cohorts["user_count"], linewidth=2)
149
  mpl_ax.fill_between(df_cohorts["cohort_day"], df_cohorts["user_count"], alpha=0.25)
 
153
  st.pyplot(mpl_fig)
154
  plt.close(mpl_fig)
155
 
156
+ st.caption("3. Native chart (Altair)")
157
+ st.area_chart(df_cohorts, x="cohort_day", y="user_count", height=400)
158
+
159
+ try:
160
+ st.caption("4. Plotly chart")
161
+ fig = px.area(df_cohorts, x="cohort_day", y="user_count", template="plotly")
162
+ fig.update_layout(height=400, margin=dict(l=20, r=20, t=20, b=20))
163
+ st.plotly_chart(fig)
164
+ except Exception as exc:
165
+ st.warning(f"Plotly не отрисован: {exc}")
166
+
167
  st.caption("Chart debug")
168
  st.metric("Rows", len(df_cohorts))
169
  st.metric("Min day", int(df_cohorts["cohort_day"].min()))