SmokeyBandit commited on
Commit
868552c
Β·
verified Β·
1 Parent(s): 6ff8317

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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 once. Flip forever. Track everything.")
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(fn=start_flipping, outputs=None)
 
 
 
135
  refresh_button.click(
136
  fn=update_all_stats,
137
  outputs=[tally_display, runtime_display, flip_log]
138
  )
139
 
140
- # Auto-refresh every 5 seconds when page loads
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__":