Spaces:
Running
Running
Commit
·
6a8a7c2
1
Parent(s):
c9b7b18
made counter add from total alredy generated of {count: 1524, last_updated: 0}
Browse files- app.py +6 -2
- generation_counter.json +1 -1
app.py
CHANGED
|
@@ -343,6 +343,10 @@ with gr.Blocks(
|
|
| 343 |
f"**🌍 Generations:** {new_count}",
|
| 344 |
)
|
| 345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
# Update character count on text input change
|
| 347 |
text_input.change(fn=update_char_count, inputs=[text_input], outputs=[char_count])
|
| 348 |
|
|
@@ -377,8 +381,8 @@ with gr.Blocks(
|
|
| 377 |
],
|
| 378 |
)
|
| 379 |
|
| 380 |
-
# Refresh
|
| 381 |
-
demo.load()
|
| 382 |
|
| 383 |
if __name__ == "__main__":
|
| 384 |
demo.queue(max_size=5)
|
|
|
|
| 343 |
f"**🌍 Generations:** {new_count}",
|
| 344 |
)
|
| 345 |
|
| 346 |
+
def refresh_counter_on_load():
|
| 347 |
+
"""Refresh the universal generation counter when the UI loads/reloads"""
|
| 348 |
+
return f"**🌍 Generations:** {load_counter()}"
|
| 349 |
+
|
| 350 |
# Update character count on text input change
|
| 351 |
text_input.change(fn=update_char_count, inputs=[text_input], outputs=[char_count])
|
| 352 |
|
|
|
|
| 381 |
],
|
| 382 |
)
|
| 383 |
|
| 384 |
+
# Refresh global generation counter on page load/refresh
|
| 385 |
+
demo.load(fn=refresh_counter_on_load, inputs=None, outputs=[generation_counter])
|
| 386 |
|
| 387 |
if __name__ == "__main__":
|
| 388 |
demo.queue(max_size=5)
|
generation_counter.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
{"count":
|
| 2 |
|
|
|
|
| 1 |
+
{"count": 1524, "last_updated": 0}
|
| 2 |
|