Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -147,13 +147,6 @@ def clear_conversation():
|
|
| 147 |
"""Clear the conversation history."""
|
| 148 |
return []
|
| 149 |
|
| 150 |
-
def clear_analytics():
|
| 151 |
-
"""Clear the analytics data."""
|
| 152 |
-
log_file = "analytics/chat_log.json"
|
| 153 |
-
if os.path.exists(log_file):
|
| 154 |
-
os.remove(log_file)
|
| 155 |
-
return "Analytics data has been cleared."
|
| 156 |
-
|
| 157 |
def plt_to_html(fig):
|
| 158 |
"""Convert matplotlib figure to HTML img tag"""
|
| 159 |
buf = io.BytesIO()
|
|
@@ -323,7 +316,10 @@ with gr.Blocks(title="Groq AI Chat Playground") as app:
|
|
| 323 |
with gr.Column():
|
| 324 |
gr.Markdown("# Usage Analytics Dashboard")
|
| 325 |
refresh_analytics_button = gr.Button("Refresh Analytics")
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
analytics_summary = gr.Markdown()
|
| 329 |
|
|
@@ -374,13 +370,7 @@ with gr.Blocks(title="Groq AI Chat Playground") as app:
|
|
| 374 |
inputs=[],
|
| 375 |
outputs=[analytics_summary, model_usage_chart, response_time_chart, analytics_table]
|
| 376 |
)
|
| 377 |
-
|
| 378 |
-
clear_analytics_button.click(
|
| 379 |
-
fn=clear_analytics,
|
| 380 |
-
inputs=[],
|
| 381 |
-
outputs=[analytics_summary, model_usage_chart, response_time_chart, analytics_table]
|
| 382 |
-
)
|
| 383 |
|
| 384 |
# Launch the app
|
| 385 |
if __name__ == "__main__":
|
| 386 |
-
app.launch(share=False)
|
|
|
|
| 147 |
"""Clear the conversation history."""
|
| 148 |
return []
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
def plt_to_html(fig):
|
| 151 |
"""Convert matplotlib figure to HTML img tag"""
|
| 152 |
buf = io.BytesIO()
|
|
|
|
| 316 |
with gr.Column():
|
| 317 |
gr.Markdown("# Usage Analytics Dashboard")
|
| 318 |
refresh_analytics_button = gr.Button("Refresh Analytics")
|
| 319 |
+
|
| 320 |
+
gr.Markdown("""
|
| 321 |
+
**Note**: Please reload the site to clear analytics data.
|
| 322 |
+
""")
|
| 323 |
|
| 324 |
analytics_summary = gr.Markdown()
|
| 325 |
|
|
|
|
| 370 |
inputs=[],
|
| 371 |
outputs=[analytics_summary, model_usage_chart, response_time_chart, analytics_table]
|
| 372 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
|
| 374 |
# Launch the app
|
| 375 |
if __name__ == "__main__":
|
| 376 |
+
app.launch(share=False)
|