dcavadia commited on
Commit
7a9cbf8
路
verified 路
1 Parent(s): 6c7a8a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -94,12 +94,18 @@ try:
94
  except Exception:
95
  theme = None # fallback to default theme
96
 
 
97
  CUSTOM_CSS = """
98
  .header {display:flex; align-items:center; gap:12px;}
99
  .badge {font-size:12px; padding:4px 8px; border-radius:12px; background:#f1f5f9; color:#334155;}
100
  .pred-card {font-size:18px;}
101
  .footer {font-size:12px; color:#64748b; text-align:center; padding:12px 0;}
102
  button, .gradio-container .gr-box, .gradio-container .gr-panel { border-radius: 10px !important; }
 
 
 
 
 
103
  """
104
 
105
  # ----------------------------
@@ -147,6 +153,7 @@ with gr.Blocks(theme=theme, css=CUSTOM_CSS) as demo:
147
  with gr.Row():
148
  nombre = gr.Label(label="Predicci贸n principal", elem_classes=["pred-card"])
149
  confianza = gr.Label(label="Confianza")
 
150
  prob_plot = gr.BarPlot(
151
  value=empty_df(),
152
  x="item",
@@ -158,8 +165,6 @@ with gr.Blocks(theme=theme, css=CUSTOM_CSS) as demo:
158
  tooltip=["item", "probability"],
159
  width=520,
160
  height=320,
161
- # Color fix for Gradio 4.27: use plot_kwargs instead of color param
162
- plot_kwargs={"color": "#ef4444"},
163
  )
164
  with gr.Tabs():
165
  with gr.TabItem("Detalles"):
 
94
  except Exception:
95
  theme = None # fallback to default theme
96
 
97
+ # CSS: basic polish + set bar color via Vega-Lite mark styling hook
98
  CUSTOM_CSS = """
99
  .header {display:flex; align-items:center; gap:12px;}
100
  .badge {font-size:12px; padding:4px 8px; border-radius:12px; background:#f1f5f9; color:#334155;}
101
  .pred-card {font-size:18px;}
102
  .footer {font-size:12px; color:#64748b; text-align:center; padding:12px 0;}
103
  button, .gradio-container .gr-box, .gradio-container .gr-panel { border-radius: 10px !important; }
104
+
105
+ /* Try to color bars uniformly in Vega-Lite output used by BarPlot in Gradio 4.27 */
106
+ .vega-embed .mark-rect, .vega-embed .mark-bar, .vega-embed .role-mark rect {
107
+ fill: #ef4444 !important;
108
+ }
109
  """
110
 
111
  # ----------------------------
 
153
  with gr.Row():
154
  nombre = gr.Label(label="Predicci贸n principal", elem_classes=["pred-card"])
155
  confianza = gr.Label(label="Confianza")
156
+ # Important: no color or plot_kwargs; let defaults render, CSS handles tint
157
  prob_plot = gr.BarPlot(
158
  value=empty_df(),
159
  x="item",
 
165
  tooltip=["item", "probability"],
166
  width=520,
167
  height=320,
 
 
168
  )
169
  with gr.Tabs():
170
  with gr.TabItem("Detalles"):