Spaces:
Sleeping
Sleeping
Commit
Β·
b641db3
1
Parent(s):
c058475
Fix indentation - move ALL event handlers inside gr.Blocks context
Browse files
app.py
CHANGED
|
@@ -2198,69 +2198,69 @@ def create_dashboard():
|
|
| 2198 |
</div>
|
| 2199 |
""")
|
| 2200 |
|
| 2201 |
-
|
| 2202 |
-
|
| 2203 |
-
|
| 2204 |
-
|
| 2205 |
-
|
| 2206 |
-
|
| 2207 |
-
|
| 2208 |
-
|
| 2209 |
-
|
| 2210 |
-
|
| 2211 |
-
|
| 2212 |
-
|
| 2213 |
-
|
| 2214 |
-
|
| 2215 |
-
|
| 2216 |
-
|
| 2217 |
-
|
| 2218 |
-
|
| 2219 |
-
|
| 2220 |
-
|
| 2221 |
-
|
| 2222 |
-
|
| 2223 |
-
|
| 2224 |
-
|
| 2225 |
-
|
| 2226 |
-
|
| 2227 |
-
|
| 2228 |
-
|
| 2229 |
-
|
| 2230 |
-
|
| 2231 |
-
|
| 2232 |
-
|
| 2233 |
-
|
| 2234 |
-
|
| 2235 |
-
|
| 2236 |
-
|
| 2237 |
-
|
| 2238 |
-
|
| 2239 |
-
|
| 2240 |
-
|
| 2241 |
-
|
| 2242 |
-
|
| 2243 |
-
|
| 2244 |
-
|
| 2245 |
-
|
| 2246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2247 |
|
| 2248 |
-
|
| 2249 |
-
|
| 2250 |
-
fn=refresh_account_overview,
|
| 2251 |
-
outputs=[portfolio_value, buying_power, cash, day_change, equity]
|
| 2252 |
-
)
|
| 2253 |
-
demo.load(fn=create_portfolio_chart, outputs=[portfolio_chart])
|
| 2254 |
-
demo.load(
|
| 2255 |
-
fn=refresh_vm_stats,
|
| 2256 |
-
outputs=[total_ipos, ipos_invested, cs_stocks, investment_rate, last_updated]
|
| 2257 |
-
)
|
| 2258 |
-
demo.load(fn=create_ipo_discovery_chart, outputs=[ipo_chart])
|
| 2259 |
-
demo.load(fn=refresh_ipo_discoveries_table, outputs=[ipo_table])
|
| 2260 |
-
demo.load(fn=refresh_investment_performance_html, outputs=[investment_performance_table])
|
| 2261 |
-
|
| 2262 |
-
demo.queue()
|
| 2263 |
-
logger.info("β
All event handlers configured successfully")
|
| 2264 |
return demo
|
| 2265 |
|
| 2266 |
except Exception as e:
|
|
|
|
| 2198 |
</div>
|
| 2199 |
""")
|
| 2200 |
|
| 2201 |
+
logger.info("π Setting up event handlers...")
|
| 2202 |
+
|
| 2203 |
+
# Event Handlers - INSIDE Blocks context
|
| 2204 |
+
|
| 2205 |
+
# Portfolio tab
|
| 2206 |
+
refresh_overview_btn.click(
|
| 2207 |
+
fn=refresh_account_overview,
|
| 2208 |
+
outputs=[portfolio_value, buying_power, cash, day_change, equity]
|
| 2209 |
+
)
|
| 2210 |
+
refresh_overview_btn.click(
|
| 2211 |
+
fn=create_portfolio_chart,
|
| 2212 |
+
outputs=[portfolio_chart]
|
| 2213 |
+
)
|
| 2214 |
+
|
| 2215 |
+
# IPO tab
|
| 2216 |
+
refresh_ipo_btn.click(
|
| 2217 |
+
fn=refresh_vm_stats,
|
| 2218 |
+
outputs=[total_ipos, ipos_invested, cs_stocks, investment_rate, last_updated]
|
| 2219 |
+
)
|
| 2220 |
+
refresh_ipo_btn.click(
|
| 2221 |
+
fn=create_ipo_discovery_chart,
|
| 2222 |
+
outputs=[ipo_chart]
|
| 2223 |
+
)
|
| 2224 |
+
refresh_ipo_btn.click(
|
| 2225 |
+
fn=refresh_ipo_discoveries_table,
|
| 2226 |
+
outputs=[ipo_table]
|
| 2227 |
+
)
|
| 2228 |
+
|
| 2229 |
+
# Investment Performance tab
|
| 2230 |
+
refresh_performance_btn.click(
|
| 2231 |
+
fn=refresh_investment_performance_html,
|
| 2232 |
+
outputs=[investment_performance_table]
|
| 2233 |
+
)
|
| 2234 |
+
|
| 2235 |
+
# VM Terminal tab
|
| 2236 |
+
execute_btn.click(
|
| 2237 |
+
fn=execute_command,
|
| 2238 |
+
inputs=[command_input],
|
| 2239 |
+
outputs=[terminal_output]
|
| 2240 |
+
)
|
| 2241 |
+
|
| 2242 |
+
# System Logs tab
|
| 2243 |
+
refresh_logs_btn.click(
|
| 2244 |
+
fn=refresh_vm_logs,
|
| 2245 |
+
outputs=[log_output]
|
| 2246 |
+
)
|
| 2247 |
+
|
| 2248 |
+
# Initial data load
|
| 2249 |
+
demo.load(
|
| 2250 |
+
fn=refresh_account_overview,
|
| 2251 |
+
outputs=[portfolio_value, buying_power, cash, day_change, equity]
|
| 2252 |
+
)
|
| 2253 |
+
demo.load(fn=create_portfolio_chart, outputs=[portfolio_chart])
|
| 2254 |
+
demo.load(
|
| 2255 |
+
fn=refresh_vm_stats,
|
| 2256 |
+
outputs=[total_ipos, ipos_invested, cs_stocks, investment_rate, last_updated]
|
| 2257 |
+
)
|
| 2258 |
+
demo.load(fn=create_ipo_discovery_chart, outputs=[ipo_chart])
|
| 2259 |
+
demo.load(fn=refresh_ipo_discoveries_table, outputs=[ipo_table])
|
| 2260 |
+
demo.load(fn=refresh_investment_performance_html, outputs=[investment_performance_table])
|
| 2261 |
|
| 2262 |
+
demo.queue()
|
| 2263 |
+
logger.info("β
All event handlers configured successfully")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2264 |
return demo
|
| 2265 |
|
| 2266 |
except Exception as e:
|