Spaces:
Runtime error
Runtime error
oscarwang2
commited on
Commit
•
9efeb57
1
Parent(s):
b7dd373
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
3 |
-
import threading
|
4 |
|
5 |
# Initialize clients
|
6 |
client1 = Client("orionai/training-data-collection_2")
|
@@ -45,19 +44,18 @@ def update_dashboard():
|
|
45 |
print(f"Error in update dashboard: {e}")
|
46 |
return 0, 0
|
47 |
|
|
|
|
|
|
|
|
|
48 |
# Create Gradio Interface
|
49 |
with gr.Blocks() as demo:
|
50 |
gr.Markdown("# Token Count Dashboard")
|
51 |
|
52 |
-
total_tokens = gr.Number(label="Total Token Count"
|
53 |
-
growth_speed = gr.Number(label="Total Growth Speed"
|
54 |
-
|
55 |
-
def refresh_metrics():
|
56 |
-
tokens, speed = update_dashboard()
|
57 |
-
total_tokens.update(value=tokens)
|
58 |
-
growth_speed.update(value=speed)
|
59 |
|
60 |
update_button = gr.Button("Update Stats")
|
61 |
-
update_button.click(refresh_metrics)
|
62 |
|
63 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
|
|
3 |
|
4 |
# Initialize clients
|
5 |
client1 = Client("orionai/training-data-collection_2")
|
|
|
44 |
print(f"Error in update dashboard: {e}")
|
45 |
return 0, 0
|
46 |
|
47 |
+
def refresh_metrics():
|
48 |
+
tokens, speed = update_dashboard()
|
49 |
+
return tokens, speed
|
50 |
+
|
51 |
# Create Gradio Interface
|
52 |
with gr.Blocks() as demo:
|
53 |
gr.Markdown("# Token Count Dashboard")
|
54 |
|
55 |
+
total_tokens = gr.Number(label="Total Token Count")
|
56 |
+
growth_speed = gr.Number(label="Total Growth Speed")
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
update_button = gr.Button("Update Stats")
|
59 |
+
update_button.click(fn=refresh_metrics, inputs=[], outputs=[total_tokens, growth_speed])
|
60 |
|
61 |
demo.launch()
|