Spaces:
Runtime error
Runtime error
Commit
·
62dcdb1
1
Parent(s):
1b6979d
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, ServiceContext
|
@@ -5,8 +8,7 @@ from llama_index.llm_predictor.chatgpt import ChatGPTLLMPredictor
|
|
5 |
|
6 |
|
7 |
index_name = "./index.json"
|
8 |
-
documents_folder = "
|
9 |
-
|
10 |
|
11 |
@st.cache_resource
|
12 |
def initialize_index(index_name, documents_folder):
|
@@ -28,9 +30,9 @@ def query_index(_index, query_text):
|
|
28 |
return str(response)
|
29 |
|
30 |
|
31 |
-
st.title("🦙 Llama Index
|
32 |
-
st.header("Welcome to the Llama Index Streamlit
|
33 |
-
st.write("Enter a query about
|
34 |
|
35 |
index = None
|
36 |
api_key = st.text_input("Enter your OpenAI API key here:", type="password")
|
@@ -53,4 +55,4 @@ if st.button("Run Query") and text is not None:
|
|
53 |
st.markdown(f"LLM Tokens Used: {index.service_context.llm_predictor._last_token_usage}")
|
54 |
|
55 |
with embed_col:
|
56 |
-
st.markdown(f"Embedding Tokens Used: {index.service_context.embed_model._last_token_usage}")
|
|
|
1 |
+
# https://github.com/logan-markewich/llama_index_starter_pack/blob/main/streamlit_vector/streamlit_demo.py
|
2 |
+
#
|
3 |
+
|
4 |
import os
|
5 |
import streamlit as st
|
6 |
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, ServiceContext
|
|
|
8 |
|
9 |
|
10 |
index_name = "./index.json"
|
11 |
+
documents_folder = "/data/python.langchain.com/en/latest"
|
|
|
12 |
|
13 |
@st.cache_resource
|
14 |
def initialize_index(index_name, documents_folder):
|
|
|
30 |
return str(response)
|
31 |
|
32 |
|
33 |
+
st.title("🦙 Llama Index LangChain 🦙")
|
34 |
+
st.header("Welcome to the Llama Index Streamlit LangChain")
|
35 |
+
st.write("Enter a query about LangChain python document. You can check out the latest python doc [here](https://python.langchain.com/en/latest/). Your query will be answered using the document as context, using embeddings from text-ada-002 and LLM completions from ChatGPT.")
|
36 |
|
37 |
index = None
|
38 |
api_key = st.text_input("Enter your OpenAI API key here:", type="password")
|
|
|
55 |
st.markdown(f"LLM Tokens Used: {index.service_context.llm_predictor._last_token_usage}")
|
56 |
|
57 |
with embed_col:
|
58 |
+
st.markdown(f"Embedding Tokens Used: {index.service_context.embed_model._last_token_usage}")
|