Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,12 +114,13 @@ load_existing_data()
|
|
| 114 |
# Build UI
|
| 115 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
| 116 |
gr.Markdown("# πͺ Eternal Coin Flipper")
|
| 117 |
-
gr.Markdown("Click
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
flip_button = gr.Button("π Start Flipping", variant="primary", size="lg")
|
| 122 |
refresh_button = gr.Button("π Refresh Stats", variant="secondary")
|
|
|
|
| 123 |
|
| 124 |
with gr.Column():
|
| 125 |
# Stats display
|
|
@@ -131,13 +132,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 131 |
flip_log = gr.Textbox(label="Last 20 Flips", lines=15, max_lines=20)
|
| 132 |
|
| 133 |
# Event handlers
|
| 134 |
-
flip_button.click(
|
|
|
|
|
|
|
|
|
|
| 135 |
refresh_button.click(
|
| 136 |
fn=update_all_stats,
|
| 137 |
outputs=[tally_display, runtime_display, flip_log]
|
| 138 |
)
|
| 139 |
|
| 140 |
-
# Auto-refresh
|
| 141 |
app.load(fn=update_all_stats, outputs=[tally_display, runtime_display, flip_log])
|
| 142 |
|
| 143 |
if __name__ == "__main__":
|
|
|
|
| 114 |
# Build UI
|
| 115 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
| 116 |
gr.Markdown("# πͺ Eternal Coin Flipper")
|
| 117 |
+
gr.Markdown("β οΈ **Zero CPU Limitation**: Click 'Refresh' to see updates (no real-time on free tier)")
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
flip_button = gr.Button("π Start Flipping", variant="primary", size="lg")
|
| 122 |
refresh_button = gr.Button("π Refresh Stats", variant="secondary")
|
| 123 |
+
gr.Markdown("π‘ *Tip: Bookmark and check back later to see progress!*")
|
| 124 |
|
| 125 |
with gr.Column():
|
| 126 |
# Stats display
|
|
|
|
| 132 |
flip_log = gr.Textbox(label="Last 20 Flips", lines=15, max_lines=20)
|
| 133 |
|
| 134 |
# Event handlers
|
| 135 |
+
flip_button.click(
|
| 136 |
+
fn=lambda: (start_flipping(), *update_all_stats()),
|
| 137 |
+
outputs=[gr.Textbox(visible=False), tally_display, runtime_display, flip_log]
|
| 138 |
+
)
|
| 139 |
refresh_button.click(
|
| 140 |
fn=update_all_stats,
|
| 141 |
outputs=[tally_display, runtime_display, flip_log]
|
| 142 |
)
|
| 143 |
|
| 144 |
+
# Auto-refresh when page loads
|
| 145 |
app.load(fn=update_all_stats, outputs=[tally_display, runtime_display, flip_log])
|
| 146 |
|
| 147 |
if __name__ == "__main__":
|