import streamlit as st
settings = {}
def app():
st.markdown("""
""", unsafe_allow_html=True)
with st.form("settings"):
footer = """
"""
st.markdown(footer, unsafe_allow_html=True)
st.title("LFQA model parameters")
settings["min_length"] = st.slider("Min length", 20, 80, st.session_state["min_length"],
help="Min response length (words)")
st.markdown("""
""", unsafe_allow_html=True)
settings["max_length"] = st.slider("Max length", 128, 320, st.session_state["max_length"],
help="Max response length (words)")
st.markdown("""
""", unsafe_allow_html=True)
col1, col2 = st.columns(2)
with col1:
settings["do_sample"] = st.checkbox("Use sampling", st.session_state["do_sample"],
help="Whether or not to use sampling ; use greedy decoding otherwise.")
with col2:
settings["early_stopping"] = st.checkbox("Early stopping", st.session_state["early_stopping"],
help="Whether to stop the beam search when at least num_beams sentences are finished per batch or not.")
st.markdown("""
""", unsafe_allow_html=True)
settings["num_beams"] = st.slider("Num beams", 1, 16, st.session_state["num_beams"],
help="Number of beams for beam search. 1 means no beam search.")
st.markdown("""
""", unsafe_allow_html=True)
settings["temperature"] = st.slider("Temperature", 0.0, 1.0, st.session_state["temperature"], step=0.1,
help="The value used to module the next token probabilities")
st.title("TTS model parameters")
settings["tts"] = st.selectbox(label="Engine", options=("Google", "HuggingFace"),
index=["Google", "HuggingFace"].index(st.session_state["tts"]),
help="Answer text-to-speech engine")
# Every form must have a submit button.
col3, col4, col5, col6 = st.columns(4)
with col3:
submitted = st.form_submit_button("Save")
with col4:
if submitted:
for k, v in settings.items():
st.session_state[k] = v
st.success('App settings saved successfully.')