HemanM commited on
Commit
0ac88b2
Β·
verified Β·
1 Parent(s): 2d10edd

Update dashboard.py

Browse files
Files changed (1) hide show
  1. dashboard.py +12 -13
dashboard.py CHANGED
@@ -1,5 +1,3 @@
1
- # dashboard.py
2
-
3
  import firebase_admin
4
  from firebase_admin import credentials, firestore
5
  import pandas as pd
@@ -7,9 +5,9 @@ import matplotlib.pyplot as plt
7
  import io
8
  import gradio as gr
9
 
10
- # Initialize Firebase Admin SDK (ensure the JSON file is in your space)
11
  if not firebase_admin._apps:
12
- cred = credentials.Certificate("evotransformer-firebase-adminsdk-fbsvc-37a4b838aa.json")
13
  firebase_admin.initialize_app(cred)
14
 
15
  db = firestore.client()
@@ -61,14 +59,15 @@ def generate_dashboard():
61
 
62
  return summary, buf
63
 
64
- with gr.Blocks() as dashboard:
65
- gr.Markdown("## πŸ“Š EvoTransformer Live Evolution Dashboard")
66
- gr.Markdown("> πŸ”„ *Below metrics are based on real-time user feedback.*")
67
-
68
- summary_text = gr.Textbox(label="Summary", interactive=False)
69
- plot = gr.Image(type="pil", label="Accuracy Plot")
 
70
 
71
- refresh = gr.Button("πŸ” Refresh Data")
72
- refresh.click(fn=generate_dashboard, outputs=[summary_text, plot])
73
 
74
- dashboard.launch()
 
 
 
1
  import firebase_admin
2
  from firebase_admin import credentials, firestore
3
  import pandas as pd
 
5
  import io
6
  import gradio as gr
7
 
8
+ # Initialize Firebase Admin SDK
9
  if not firebase_admin._apps:
10
+ cred = credentials.Certificate("firebase_key.json")
11
  firebase_admin.initialize_app(cred)
12
 
13
  db = firestore.client()
 
59
 
60
  return summary, buf
61
 
62
+ def render_dashboard():
63
+ with gr.Blocks() as dashboard:
64
+ gr.Markdown("## πŸ“Š EvoTransformer Live Evolution Dashboard")
65
+ gr.Markdown("> πŸ”„ *Below metrics are based on real-time user feedback.*")
66
+
67
+ summary_text = gr.Textbox(label="Summary", interactive=False)
68
+ plot = gr.Image(type="pil", label="Accuracy Plot")
69
 
70
+ refresh = gr.Button("πŸ” Refresh Data")
71
+ refresh.click(fn=generate_dashboard, outputs=[summary_text, plot])
72
 
73
+ return dashboard