cicboy commited on
Commit
bfad701
Β·
1 Parent(s): 5d2f635

update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -1
app.py CHANGED
@@ -233,6 +233,57 @@ def generate_report(crypto_name, currency, days):
233
  # ----------------------
234
 
235
  with gr.Blocks(theme=gr.themes.Monochrome()) as app:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  gr.Markdown("# πŸͺ™ Crypto Intelligence Dashboard")
237
  gr.Markdown("Run a full multi-agent crypto analysis using structured JSON tools.")
238
 
@@ -252,7 +303,12 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as app:
252
  label="Historical Lookback (days)"
253
  )
254
 
255
- run_button = gr.Button("πŸš€ Run Full Analysis", variant="primary")
 
 
 
 
 
256
  report_output = gr.Markdown(label="πŸ“Š Intelligence Report")
257
 
258
  run_button.click(
 
233
  # ----------------------
234
 
235
  with gr.Blocks(theme=gr.themes.Monochrome()) as app:
236
+ gr.HTML("""
237
+ <style>
238
+ #run-btn .rocket{
239
+ display: inline-block;
240
+ transition: transform 0.2s ease;
241
+ }
242
+
243
+ #run-btn.loading .rocket {
244
+ animation: spin 1s linear infinite;
245
+ }
246
+
247
+ @keyframes spin {
248
+ from { transform: rotate(0deg); }
249
+ to { transform: rotate(360deg); }
250
+ }
251
+ </style>
252
+ """)
253
+
254
+ # ---- Spinning Rocket JS ----
255
+ gr.HTML("""
256
+ <script>
257
+ function setLoadingState(isLoading) {
258
+ const btn = document.getElementById("run-btn");
259
+ if (!btn) return;
260
+ if (isLoading) {
261
+ btn.classList.add("loading");
262
+ btn.disabled = true;
263
+ } else {
264
+ btn.classList.remove("loading");
265
+ btn.disabled = false;
266
+ }
267
+ }
268
+
269
+ window.addEventListener("DOMContentLoaded", () => {
270
+ const btn = document.getElementById("run-btn");
271
+ if (!btn) return;
272
+
273
+ btn.addEventListener("click", () => {
274
+ setLoadingState(true);
275
+ });
276
+
277
+ // Detect when output changes β†’ stop spinning
278
+ const observer = new MutationObserver(() => {
279
+ setLoadingState(false);
280
+ });
281
+
282
+ observer.observe(document.body, { childList: true, subtree: true });
283
+ });
284
+ </script>
285
+ """)
286
+
287
  gr.Markdown("# πŸͺ™ Crypto Intelligence Dashboard")
288
  gr.Markdown("Run a full multi-agent crypto analysis using structured JSON tools.")
289
 
 
303
  label="Historical Lookback (days)"
304
  )
305
 
306
+ run_button = gr.Button(
307
+ '<span class="rocket">πŸš€</span> Run Full Analysis',
308
+ variant="primary",
309
+ elem_id="run-btn"
310
+ )
311
+
312
  report_output = gr.Markdown(label="πŸ“Š Intelligence Report")
313
 
314
  run_button.click(