Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -486,11 +486,11 @@ if st.button("Generate Audio", key="generate_audio_button"):
|
|
486 |
else:
|
487 |
st.info("Description field is required.")
|
488 |
|
489 |
-
# Display the login interface if
|
490 |
-
if st.session_state.get('login_needed'):
|
491 |
st.header("Please log in to continue")
|
492 |
username = st.text_input("Username", key="username_input")
|
493 |
-
password = st.text_input("Password", type="password", key="password_input")
|
494 |
|
495 |
if st.button("Log in", key="login_button"):
|
496 |
login_url = "https://songlabai.com/wp-json/jwt-auth/v1/token"
|
@@ -505,7 +505,7 @@ if st.session_state.get('login_needed'):
|
|
505 |
st.session_state["session_id"] = str(uuid.uuid4()) # Generate new session ID
|
506 |
st.success("Logged in successfully!")
|
507 |
st.session_state['login_needed'] = False
|
508 |
-
# Retrieve the parameters and generate audio
|
509 |
params = st.session_state.get('generate_audio_params')
|
510 |
if params:
|
511 |
generate_audio(**params)
|
@@ -515,7 +515,6 @@ if st.session_state.get('login_needed'):
|
|
515 |
# Keep login_needed True
|
516 |
# Add Register link
|
517 |
st.markdown("Don't have an account? [Register here](https://songlabai.com/register/)")
|
518 |
-
|
519 |
else:
|
520 |
pass # Do nothing if login is not needed
|
521 |
|
|
|
486 |
else:
|
487 |
st.info("Description field is required.")
|
488 |
|
489 |
+
# Display the login interface if login_needed and user is not logged in
|
490 |
+
if st.session_state.get('login_needed') and st.session_state.get("jwt_token") is None:
|
491 |
st.header("Please log in to continue")
|
492 |
username = st.text_input("Username", key="username_input")
|
493 |
+
password = st.text_input("Password", type="password", key="password_input", value="")
|
494 |
|
495 |
if st.button("Log in", key="login_button"):
|
496 |
login_url = "https://songlabai.com/wp-json/jwt-auth/v1/token"
|
|
|
505 |
st.session_state["session_id"] = str(uuid.uuid4()) # Generate new session ID
|
506 |
st.success("Logged in successfully!")
|
507 |
st.session_state['login_needed'] = False
|
508 |
+
# Retrieve the parameters and generate audio if they were stored
|
509 |
params = st.session_state.get('generate_audio_params')
|
510 |
if params:
|
511 |
generate_audio(**params)
|
|
|
515 |
# Keep login_needed True
|
516 |
# Add Register link
|
517 |
st.markdown("Don't have an account? [Register here](https://songlabai.com/register/)")
|
|
|
518 |
else:
|
519 |
pass # Do nothing if login is not needed
|
520 |
|