INNER CODE UNIT · Python
start_frontend
underneathall/pinferencia · pinferencia/main.py:48
def start_frontend(file_content, main_script_path=None, **kwargs):
bootstrap.load_config_options(flag_options=kwargs)
# use a customized frontend script if provided
if main_script_path:
bootstrap.run(main_script_path, "", "", flag_options=kwargs)
else:
# create a temporary file as the frontend script
with TemporaryDirectory() as temp_dir:
main_script_path = os.path.join(temp_dir, "proxy.py")
with open(main_script_path, "w") as f:
f.write(file_content)
streamlit._is_running_with_streamlit = True
check_credentials()
bootstrap.run(main_script_path, "", "", flag_options=kwargs)