Hi All,
Iâm deploying an app for queue monitoring.
Once the user indicates his name and phone number, the app should display customerâs position in the queue. But if his phone number is already in the list, I will tell him âyou canât sign in, youâre already in the listâ (in french)
Iâm able to display the message when his phone is in the list, but I canât display the incremental number. I see a blank page. Here is the code
import streamlit as st
from streamlit import caching
import pandas as pd
from datetime import datetime, date
from streamlit_server_state import server_state, server_state_lock
def cache_clear_dt(dummy):
clear_dt = date.today()
return clear_dt
if cache_clear_dt(âdummyâ)<date.today():
caching.clear_cache()
with server_state_lock[ân_initâ]: # Lock the âcountâ state for thread-safety
if ân_initâ not in server_state:
server_state.n_init = 0
#st.session_state.n_init=0 #A ne pas réctiver
#if ân_initâ not in st.session_state:
#st.session_state.n_init = 0
#if st.session_state.n_init ==7:
#st.session_state.n_init = 0
with server_state_lock[âliste_numâ]: # Lock the âcountâ state for thread-safety
if âliste_numâ not in server_state:
server_state.liste_num =
#if âliste_numâ not in st.session_state:
#st.session_state.liste_num =
now=datetime.now()
#n_init = 0
#liste_num=
#@st.cache
def main():
global n_init
st.title(âApplication de gestion de fil dâattente INNOV Salonâ)
st.subheader(âVersion Testâ)
with st.form(key='myform'):
Prenom = st.text_input("Prénom")
num_tel = st.text_input("Votre numéro de téléphone")
submit_button = st.form_submit_button("Valider")
if submit_button:
st.info("RĂ©sultats")
#num_tel = input("Merci d'indiquer votre numéro de téléphone ? : ")
if num_tel in server_state.liste_num:
st.write("Vous ne pouvez pas vous inscrire, vous ĂȘtes dĂ©jĂ sur la liste")
else:
st.write("ICI")
server_state.liste_num.append(str(num_tel))
#now=datetime.now()
#with server_state_lock.n_init:
server_state.n_init=server_state.n_init+1
#dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
dt_jour=now.strftime("%d/%m/%Y")
dt_heure = now.strftime("%H:%M:%S")
st.write("Bonjour "+Prenom)
st.write("Nous sommes le ",dt_jour)
st.write("Il est : ", dt_heure)
st.write("Vous ĂȘtes le numĂ©ro "+str(server_state.n_init))
if name==âmainâ:
main()