Spaces:
Runtime error
Runtime error
deployable
Browse files
app.py
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import weave
|
| 2 |
|
| 3 |
import streamlit as st
|
| 4 |
from rag.rag import SimpleRAGPipeline
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
WANDB_PROJECT = "paper_reader"
|
| 7 |
|
| 8 |
weave.init(f"{WANDB_PROJECT}")
|
| 9 |
|
| 10 |
-
st.set_page_config(page_title="Chat with the Llama 3 paper!", page_icon="π¦", layout="centered", initial_sidebar_state="auto", menu_items=None)
|
| 11 |
st.title("Chat with the Llama 3 paper π¬π¦")
|
| 12 |
|
| 13 |
@st.cache_resource(show_spinner=False)
|
|
@@ -22,7 +32,6 @@ if "rag_pipeline" not in st.session_state.keys():
|
|
| 22 |
|
| 23 |
rag_pipeline = st.session_state["rag_pipeline"]
|
| 24 |
|
| 25 |
-
# openai_api_key = st.sidebar.text_input('OpenAI API Key', type='password')
|
| 26 |
|
| 27 |
def generate_response(query):
|
| 28 |
response = rag_pipeline.predict(query)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
| 3 |
+
|
| 4 |
import weave
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
from rag.rag import SimpleRAGPipeline
|
| 8 |
|
| 9 |
+
st.set_page_config(page_title="Chat with the Llama 3 paper!", page_icon="π¦", layout="centered", initial_sidebar_state="auto", menu_items=None)
|
| 10 |
+
|
| 11 |
+
wandb_api_key = st.sidebar.text_input('WANDB_API_KEY', type='password')
|
| 12 |
+
if len(wandb_api_key)>=10:
|
| 13 |
+
os.environ["WANDB_API_KEY"] = wandb_api_key
|
| 14 |
+
else:
|
| 15 |
+
st.stop()
|
| 16 |
+
|
| 17 |
WANDB_PROJECT = "paper_reader"
|
| 18 |
|
| 19 |
weave.init(f"{WANDB_PROJECT}")
|
| 20 |
|
|
|
|
| 21 |
st.title("Chat with the Llama 3 paper π¬π¦")
|
| 22 |
|
| 23 |
@st.cache_resource(show_spinner=False)
|
|
|
|
| 32 |
|
| 33 |
rag_pipeline = st.session_state["rag_pipeline"]
|
| 34 |
|
|
|
|
| 35 |
|
| 36 |
def generate_response(query):
|
| 37 |
response = rag_pipeline.predict(query)
|