-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (25 loc) · 808 Bytes
/
app.py
File metadata and controls
32 lines (25 loc) · 808 Bytes
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
30
31
32
import streamlit as st
from dotenv import load_dotenv
from main_page import main_page
from chat_page import chat_page
from evaluation_page import evaluation_page
# Load environment variables once for all pages
load_dotenv(".env")
PAGES = {
"Prompt Refiner": main_page,
"Playground": chat_page,
"Evaluation": evaluation_page
}
st.sidebar.title('Navigation')
# Initialize session state for the page
if 'page' not in st.session_state:
st.session_state.page = "Prompt Refiner"
# Function to set the page
def set_page(page_name):
st.session_state.page = page_name
# Create buttons for each page
for page_name in PAGES.keys():
st.sidebar.button(page_name, on_click=set_page, args=(page_name,))
# Get the page from session state and call it
page = PAGES[st.session_state.page]
page()