Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import asyncio
|
3 |
import os
|
4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
5 |
-
from langchain.document_loaders import PyPDFLoader
|
6 |
from langchain.prompts import SystemMessagePromptTemplate, HumanMessagePromptTemplate
|
7 |
from langchain.vectorstores import Chroma
|
8 |
from langchain.embeddings import OpenAIEmbeddings
|
@@ -101,3 +109,6 @@ if user_query:
|
|
101 |
st.write("Context used:")
|
102 |
for i, context in enumerate(result["context"], 1):
|
103 |
st.write(f"{i}. {context[:100]}...")
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
import sys
|
3 |
+
|
4 |
+
def install(package):
|
5 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
6 |
+
|
7 |
+
# Install required packages
|
8 |
+
install("streamlit")
|
9 |
+
|
10 |
import streamlit as st
|
11 |
import asyncio
|
12 |
import os
|
13 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
14 |
from langchain.prompts import SystemMessagePromptTemplate, HumanMessagePromptTemplate
|
15 |
from langchain.vectorstores import Chroma
|
16 |
from langchain.embeddings import OpenAIEmbeddings
|
|
|
109 |
st.write("Context used:")
|
110 |
for i, context in enumerate(result["context"], 1):
|
111 |
st.write(f"{i}. {context[:100]}...")
|
112 |
+
|
113 |
+
if __name__ == "__main__":
|
114 |
+
st.run()
|