markrodrigo commited on
Commit ·
81c2d8b
1
Parent(s): fa9ffe9
finish this
Browse files
app.py
CHANGED
|
@@ -142,7 +142,13 @@ with gr.Blocks(title="Text to PostGIS Postgresql via Llama 3.2") as demo:
|
|
| 142 |
submit_btn.click(fn=respond, inputs=[msg, chatbot], outputs=[chatbot, msg, counter_display])
|
| 143 |
msg.submit(fn=respond, inputs=[msg, chatbot], outputs=[chatbot, msg, counter_display])
|
| 144 |
# Display counter (optional)
|
|
|
|
|
|
|
|
|
|
| 145 |
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
if __name__ == "__main__":
|
| 148 |
print("Gradio version:", gr.__version__)
|
|
|
|
| 142 |
submit_btn.click(fn=respond, inputs=[msg, chatbot], outputs=[chatbot, msg, counter_display])
|
| 143 |
msg.submit(fn=respond, inputs=[msg, chatbot], outputs=[chatbot, msg, counter_display])
|
| 144 |
# Display counter (optional)
|
| 145 |
+
|
| 146 |
+
# CRITICAL: This triggers every time the page loads or refreshes!
|
| 147 |
+
demo.load(fn=get_latest_counter, inputs=[], outputs=counter_display)
|
| 148 |
|
| 149 |
+
def get_latest_counter():
|
| 150 |
+
global global_counter
|
| 151 |
+
return global_counter # Dynamically fetches the current server value
|
| 152 |
|
| 153 |
if __name__ == "__main__":
|
| 154 |
print("Gradio version:", gr.__version__)
|