QAway-to commited on
Commit
343fdcb
·
1 Parent(s): e55ebde

Revert "New tabs and functions v4.5"

Browse files

This reverts commit 978bdd6a

Files changed (1) hide show
  1. app.py +15 -32
app.py CHANGED
@@ -46,7 +46,7 @@ with gr.Blocks(css=base_css) as demo:
46
  with gr.TabItem("Comparison Table"):
47
  from core.comparison_table import show_comparison_table
48
  pid_a = gr.Textbox(label="Portfolio A", value="3852a354-e66e-4bc5-97e9-55124e31e687")
49
- pid_b = gr.Textbox(label="Portfolio B", value="b1ef37aa-5b9a-41b4-9394-8823f2de36bb")
50
  compare_btn = gr.Button("Load Comparison", variant="primary")
51
  comp_table = gr.Dataframe(label="Comparative Metrics", wrap=True)
52
  comp_comment = gr.Textbox(label="AI Commentary", lines=14, elem_id="llm_comment_box")
@@ -92,25 +92,16 @@ with gr.Blocks(css=base_css) as demo:
92
  for a, b in available_pairs:
93
  if selected_pair.lower() == f"{a} vs {b}":
94
  return build_price_chart((a, b)), build_volatility_chart((a, b))
95
- # fallback по умолчанию
96
  return build_price_chart(("bitcoin", "ethereum")), build_volatility_chart(("bitcoin", "ethereum"))
97
 
98
- # обновляем графики при смене пары
99
  pair_selector.change(fn=update_visuals, inputs=pair_selector, outputs=[price_plot, vol_plot])
100
- # первичная инициализация при запуске
101
- demo.load(fn=update_visuals, inputs=None, outputs=[price_plot, vol_plot], _js="() => 'Bitcoin vs Ethereum'")
102
 
103
- <<<<<<< HEAD
104
- =======
105
-
106
- # первичная инициализация при запуске (Gradio 5.x compatible)
107
  def init_visuals():
108
  return update_visuals("Bitcoin vs Ethereum")
109
 
110
  demo.load(fn=init_visuals, inputs=None, outputs=[price_plot, vol_plot])
111
 
112
- >>>>>>> parent of 53d7057 (Change UI v1.0)
113
- # --- Crypto Intelligence Dashboard (Plotly Edition + KPI line) ---
114
  with gr.TabItem("Crypto Intelligence Dashboard"):
115
  gr.HTML(f"<style>{crypto_css}</style>")
116
 
@@ -120,23 +111,14 @@ with gr.Blocks(css=base_css) as demo:
120
  with gr.Row(elem_id="controls_row"):
121
  top_slider = gr.Slider(
122
  label="Top N coins",
123
- minimum=20,
124
- maximum=100,
125
- step=10,
126
- value=50,
127
- scale=70,
128
  )
129
- load_btn = gr.Button("Generate Dashboard", variant="primary", scale=30)
130
 
131
  with gr.Row(equal_height=True, elem_id="main_charts_row"):
132
  with gr.Column(scale=70):
133
  treemap_plot = gr.Plot(label="Market Composition")
134
  with gr.Column(scale=30):
135
- ai_box = gr.Textbox(
136
- label="AI Market Summary",
137
- lines=18,
138
- elem_id="ai_summary_sidebar",
139
- )
140
 
141
  with gr.Row(equal_height=True, elem_id="bottom_charts_row"):
142
  movers_plot = gr.Plot(label="Top Movers", scale=50)
@@ -144,28 +126,29 @@ with gr.Blocks(css=base_css) as demo:
144
 
145
  def run_dash(n):
146
  fig_treemap, fig_bar, fig_bubble, ai_comment, kpi_text = build_crypto_dashboard(n)
147
- return (
148
- fig_treemap,
149
- fig_bar,
150
- fig_bubble,
151
- ai_comment,
152
- f"<div class='kpi-line'>{kpi_text}</div>",
153
- )
154
 
155
- load_btn.click(
156
  fn=run_dash,
157
  inputs=top_slider,
158
  outputs=[treemap_plot, movers_plot, scatter_plot, ai_box, kpi_line],
159
  show_progress="minimal",
160
  )
161
 
162
- # --- Footer ---
 
 
 
 
 
 
 
 
163
  gr.Markdown("---")
164
  gr.Markdown(
165
  "<center><small style='color:#6e7681;'>Developed with Featherless.ai • Powered by OpenAI-compatible API</small></center>",
166
  elem_classes="footer",
167
  )
168
 
169
- # === Launch ===
170
  if __name__ == "__main__":
171
  demo.launch()
 
46
  with gr.TabItem("Comparison Table"):
47
  from core.comparison_table import show_comparison_table
48
  pid_a = gr.Textbox(label="Portfolio A", value="3852a354-e66e-4bc5-97e9-55124e31e687")
49
+ pid_b = gr.Textbox(label="Portfolio B", value="b1ef37aa-5b9a-41b4-8823f2de36bb")
50
  compare_btn = gr.Button("Load Comparison", variant="primary")
51
  comp_table = gr.Dataframe(label="Comparative Metrics", wrap=True)
52
  comp_comment = gr.Textbox(label="AI Commentary", lines=14, elem_id="llm_comment_box")
 
92
  for a, b in available_pairs:
93
  if selected_pair.lower() == f"{a} vs {b}":
94
  return build_price_chart((a, b)), build_volatility_chart((a, b))
 
95
  return build_price_chart(("bitcoin", "ethereum")), build_volatility_chart(("bitcoin", "ethereum"))
96
 
 
97
  pair_selector.change(fn=update_visuals, inputs=pair_selector, outputs=[price_plot, vol_plot])
 
 
98
 
 
 
 
 
99
  def init_visuals():
100
  return update_visuals("Bitcoin vs Ethereum")
101
 
102
  demo.load(fn=init_visuals, inputs=None, outputs=[price_plot, vol_plot])
103
 
104
+ # --- Crypto Intelligence Dashboard (Plotly Edition + KPI line, auto-load) ---
 
105
  with gr.TabItem("Crypto Intelligence Dashboard"):
106
  gr.HTML(f"<style>{crypto_css}</style>")
107
 
 
111
  with gr.Row(elem_id="controls_row"):
112
  top_slider = gr.Slider(
113
  label="Top N coins",
114
+ minimum=20, maximum=100, step=10, value=50, scale=100,
 
 
 
 
115
  )
 
116
 
117
  with gr.Row(equal_height=True, elem_id="main_charts_row"):
118
  with gr.Column(scale=70):
119
  treemap_plot = gr.Plot(label="Market Composition")
120
  with gr.Column(scale=30):
121
+ ai_box = gr.Textbox(label="AI Market Summary", lines=18, elem_id="ai_summary_sidebar")
 
 
 
 
122
 
123
  with gr.Row(equal_height=True, elem_id="bottom_charts_row"):
124
  movers_plot = gr.Plot(label="Top Movers", scale=50)
 
126
 
127
  def run_dash(n):
128
  fig_treemap, fig_bar, fig_bubble, ai_comment, kpi_text = build_crypto_dashboard(n)
129
+ return fig_treemap, fig_bar, fig_bubble, ai_comment, f"<div class='kpi-line'>{kpi_text}</div>"
 
 
 
 
 
 
130
 
131
+ top_slider.change(
132
  fn=run_dash,
133
  inputs=top_slider,
134
  outputs=[treemap_plot, movers_plot, scatter_plot, ai_box, kpi_line],
135
  show_progress="minimal",
136
  )
137
 
138
+ def init_crypto():
139
+ return run_dash(50)
140
+
141
+ demo.load(
142
+ fn=init_crypto,
143
+ inputs=None,
144
+ outputs=[treemap_plot, movers_plot, scatter_plot, ai_box, kpi_line],
145
+ )
146
+
147
  gr.Markdown("---")
148
  gr.Markdown(
149
  "<center><small style='color:#6e7681;'>Developed with Featherless.ai • Powered by OpenAI-compatible API</small></center>",
150
  elem_classes="footer",
151
  )
152
 
 
153
  if __name__ == "__main__":
154
  demo.launch()