calmgoose commited on
Commit
02e980b
Β·
1 Parent(s): f53ad1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -11,9 +11,16 @@ from langchain import PromptTemplate
11
 
12
  st.set_page_config(page_title="Talk2Book", page_icon="πŸ“–")
13
 
14
- # set later in the sidebar section
15
- BOOK_NAME = st.empty()
16
- AUTHOR_NAME = st.empty()
 
 
 
 
 
 
 
17
 
18
  st.title(f"Talk2Book: {BOOK_NAME}")
19
  st.markdown(f"#### Have a conversation with {BOOK_NAME} by {AUTHOR_NAME} πŸ™Š")
@@ -124,15 +131,8 @@ def get_answer(question):
124
 
125
 
126
 
127
- ##### sidebar ####
128
  with st.sidebar:
129
- book = st.radio("Choose book: ",
130
- ["1984 - George Orwell", "The Almanac of Naval Ravikant - Eric Jorgenson"]
131
- )
132
- # update st.empty() variables from earlier
133
- BOOK_NAME.text(book.split("-")[0][:-1]) # "1984 - George Orwell" -> "1984"
134
- AUTHOR_NAME.text(book.split("-")[1][1:]) # "1984 - George Orwell" -> "George Orwell"
135
-
136
  api_key = st.text_input(label = "Paste your OpenAI API key here to get started",
137
  type = "password",
138
  help = "This isn't saved πŸ™ˆ"
 
11
 
12
  st.set_page_config(page_title="Talk2Book", page_icon="πŸ“–")
13
 
14
+
15
+ #### sidebar section 1 ####
16
+ with st.sidebar:
17
+ book = st.radio("Choose book: ",
18
+ ["1984 - George Orwell", "The Almanac of Naval Ravikant - Eric Jorgenson"]
19
+ )
20
+
21
+ BOOK_NAME = book.split("-")[0][:-1] # "1984 - George Orwell" -> "1984"
22
+ AUTHOR_NAME = book.split("-")[1][1:] # "1984 - George Orwell" -> "George Orwell"
23
+
24
 
25
  st.title(f"Talk2Book: {BOOK_NAME}")
26
  st.markdown(f"#### Have a conversation with {BOOK_NAME} by {AUTHOR_NAME} πŸ™Š")
 
131
 
132
 
133
 
134
+ ##### sidebar section 2 ####
135
  with st.sidebar:
 
 
 
 
 
 
 
136
  api_key = st.text_input(label = "Paste your OpenAI API key here to get started",
137
  type = "password",
138
  help = "This isn't saved πŸ™ˆ"