-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.py
More file actions
29 lines (26 loc) · 1.03 KB
/
utils.py
File metadata and controls
29 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
def reset_session() -> None:
st.session_state['temperature'] = 0.0
st.session_state['token_limit'] = 256
st.session_state['top_k'] = 40
st.session_state['top_p'] = 0.8
st.session_state['debug_mode'] = False
st.session_state['prompt'] = []
st.session_state['response'] = []
def hard_reset_session() -> None:
st.session_state = {states : [] for states in st.session_state}
def create_session_state():
if 'temperature' not in st.session_state:
st.session_state['temperature'] = 0.0
if 'token_limit' not in st.session_state:
st.session_state['token_limit'] = 256
if 'top_k' not in st.session_state:
st.session_state['top_k'] = 40
if 'top_p' not in st.session_state:
st.session_state['top_p'] = 0.8
if 'debug_mode' not in st.session_state:
st.session_state['debug_mode'] = False
if 'prompt' not in st.session_state:
st.session_state['prompt'] = []
if 'response' not in st.session_state:
st.session_state['response'] = []