Spaces:
Build error
Build error
Kaushik Rajan
commited on
Commit
·
52e6594
1
Parent(s):
0417f51
feat: implement dark mode for plots
Browse files
app.py
CHANGED
@@ -260,7 +260,7 @@ def generate_post_game_analysis(history, winner):
|
|
260 |
def create_interface():
|
261 |
"""Creates the Gradio web interface for the simulator."""
|
262 |
|
263 |
-
with gr.Blocks(title=TITLE, theme=
|
264 |
game_env = gr.State(BusinessCompetitionEnv())
|
265 |
|
266 |
gr.Markdown(f"# 🎮 {TITLE}")
|
@@ -351,13 +351,24 @@ def create_interface():
|
|
351 |
if df.empty:
|
352 |
return None, None, None
|
353 |
|
354 |
-
|
|
|
|
|
|
|
|
|
|
|
355 |
fig_ms.update_layout(yaxis_range=[0,100], legend_title_text='')
|
356 |
|
357 |
-
fig_b = px.line(df, x="Quarter", y=["Player Budget", "AI Budget"],
|
|
|
|
|
|
|
358 |
fig_b.update_layout(legend_title_text='')
|
359 |
|
360 |
-
fig_q = px.line(df, x="Quarter", y=["Player Product Quality", "AI Product Quality"],
|
|
|
|
|
|
|
361 |
fig_q.update_layout(legend_title_text='')
|
362 |
|
363 |
return fig_ms, fig_b, fig_q
|
|
|
260 |
def create_interface():
|
261 |
"""Creates the Gradio web interface for the simulator."""
|
262 |
|
263 |
+
with gr.Blocks(title=TITLE, theme="gradio/dark") as demo:
|
264 |
game_env = gr.State(BusinessCompetitionEnv())
|
265 |
|
266 |
gr.Markdown(f"# 🎮 {TITLE}")
|
|
|
351 |
if df.empty:
|
352 |
return None, None, None
|
353 |
|
354 |
+
dark_template = "plotly_dark"
|
355 |
+
|
356 |
+
fig_ms = px.line(df, x="Quarter", y=["Player Market Share", "AI Market Share"],
|
357 |
+
title="Market Share (%)", markers=True,
|
358 |
+
color_discrete_map={"Player Market Share": "#3b82f6", "AI Market Share": "#ef4444"},
|
359 |
+
template=dark_template)
|
360 |
fig_ms.update_layout(yaxis_range=[0,100], legend_title_text='')
|
361 |
|
362 |
+
fig_b = px.line(df, x="Quarter", y=["Player Budget", "AI Budget"],
|
363 |
+
title="Budget ($)", markers=True,
|
364 |
+
color_discrete_map={"Player Budget": "#3b82f6", "AI Budget": "#ef4444"},
|
365 |
+
template=dark_template)
|
366 |
fig_b.update_layout(legend_title_text='')
|
367 |
|
368 |
+
fig_q = px.line(df, x="Quarter", y=["Player Product Quality", "AI Product Quality"],
|
369 |
+
title="Product Quality Index", markers=True,
|
370 |
+
color_discrete_map={"Player Product Quality": "#3b82f6", "AI Product Quality": "#ef4444"},
|
371 |
+
template=dark_template)
|
372 |
fig_q.update_layout(legend_title_text='')
|
373 |
|
374 |
return fig_ms, fig_b, fig_q
|