ayut commited on
Commit
7e9ffd9
β€’
1 Parent(s): 85bfd70
Files changed (2) hide show
  1. .DS_Store +0 -0
  2. app.py +10 -15
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
 
3
  os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
 
4
 
5
  import streamlit as st
6
  import weave
@@ -14,31 +15,25 @@ st.set_page_config(
14
  menu_items=None,
15
  )
16
 
17
- wandb_api_key = st.sidebar.text_input("WANDB_API_KEY", type="password")
18
- if len(wandb_api_key) >= 10:
19
- os.environ["WANDB_API_KEY"] = wandb_api_key
20
- else:
21
- st.stop()
22
-
23
  WANDB_PROJECT = "paper_reader"
24
 
25
  weave.init(f"{WANDB_PROJECT}")
26
 
27
  st.title("Chat with the Llama 3 paper πŸ’¬πŸ¦™")
28
 
 
 
 
 
 
29
 
30
- @st.cache_resource(show_spinner=False)
31
- def load_rag_pipeline():
32
- rag_pipeline = SimpleRAGPipeline()
33
- rag_pipeline.build_query_engine()
34
-
35
- return rag_pipeline
36
 
37
 
38
- if "rag_pipeline" not in st.session_state.keys():
39
- st.session_state.rag_pipeline = load_rag_pipeline()
40
 
41
- rag_pipeline = st.session_state["rag_pipeline"]
42
 
43
 
44
  def generate_response(query):
 
1
  import os
2
 
3
  os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
4
+ os.environ["WANDB_API_KEY"] = os.getenv("WANDB_API_KEY")
5
 
6
  import streamlit as st
7
  import weave
 
15
  menu_items=None,
16
  )
17
 
 
 
 
 
 
 
18
  WANDB_PROJECT = "paper_reader"
19
 
20
  weave.init(f"{WANDB_PROJECT}")
21
 
22
  st.title("Chat with the Llama 3 paper πŸ’¬πŸ¦™")
23
 
24
+ with st.spinner('Loading the RAG pipeline...'):
25
+ @st.cache_resource(show_spinner=False)
26
+ def load_rag_pipeline():
27
+ rag_pipeline = SimpleRAGPipeline()
28
+ rag_pipeline.build_query_engine()
29
 
30
+ return rag_pipeline
 
 
 
 
 
31
 
32
 
33
+ if "rag_pipeline" not in st.session_state.keys():
34
+ st.session_state.rag_pipeline = load_rag_pipeline()
35
 
36
+ rag_pipeline = st.session_state["rag_pipeline"]
37
 
38
 
39
  def generate_response(query):