import streamlit as st from faker import Faker @st.cache_resource(show_spinner=False) def faker_lang(locale: str = "it_IT"): return Faker(locale) def generate_personal_data(): st.session_state["fake_personal_info"] = {} st.session_state["fake_personal_info"]["first_name"] = faker_lang().first_name() st.session_state["fake_personal_info"]["last_name"] = faker_lang().last_name() st.session_state["fake_personal_info"]["address"] = faker_lang().address().replace("\n", "\n\n") # st.session_state["fake_personal_info"]["domain_name"] = faker_lang().domain_name() st.session_state["fake_personal_info"]["email"] = "{}{}@{}".format( st.session_state["first_name"].lower(), st.session_state["last_name"].lower(), "fake_example.it", ) st.session_state["fake_personal_info"]["phone_number"] = "(+39) 999-999-999" # faker_lang().phone_number() st.session_state["fake_personal_info"]["date_of_birth"] = ( faker_lang().date_of_birth().strftime("%d/%m/%Y") ) def display_personal_data(): st.subheader("Mock Identity:") c1, c2 = st.columns([1, 2]) c1.write(f"**Name:** ") c2.write(f"{st.session_state['fake_personal_info']['first_name']} {st.session_state['last_name']}") c1, c2 = st.columns([1, 2]) c1.write(f"**Address:** ") c2.write(f"{st.session_state['fake_personal_info']['address']}") # c1, c2 = st.columns([1, 2]) c1.write(f"**Email:** ") c2.write(f"{st.session_state['fake_personal_info']['email']}") c1, c2 = st.columns([1, 2]) c1.write(f"**Phone number:** ") c2.write(f"{st.session_state['fake_personal_info']['phone_number']}") c1, c2 = st.columns([1, 2]) c1.write(f"**Date of Birth:** ") c2.write(f"{st.session_state['fake_personal_info']['date_of_birth']}")