File size: 515 Bytes
fa2034d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import streamlit as st

def set_state_if_absent(key, value):
    if key not in st.session_state:
        st.session_state[key] = value

def set_initial_state():
    set_state_if_absent("question", "Ask something here?")
    set_state_if_absent("results_extractive", None)
    set_state_if_absent("results_generative", None)
    set_state_if_absent("task", None)

def reset_results(*args):
    st.session_state.results_extractive = None
    st.session_state.results_generative = None
    st.session_state.task = None