multimodalart's picture
Update app.py
1de1887 verified
raw
history blame
459 Bytes
import streamlit as st
import threading
import time
def long_running_task():
time.sleep(5)
@st.cache_resource
def get_global_lock():
return threading.Lock()
global_lock = get_global_lock()
# Add a button to start the task
if st.button('Start long running task'):
with st.spinner("Running long running task"):
with global_lock:
st.write("Task started")
long_running_task()
st.write("Task completed")