Orami01 commited on
Commit
793769c
·
1 Parent(s): bf98f0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import streamlit as st
 
2
  from langchain.document_loaders.csv_loader import CSVLoader
3
  from langchain.text_splitter import RecursiveCharacterTextSplitter
4
  from langchain.embeddings import HuggingFaceEmbeddings
@@ -8,6 +9,9 @@ from langchain.memory import ConversationBufferMemory
8
  from langchain.chains import ConversationalRetrievalChain
9
  import sys
10
 
 
 
 
11
  DB_FAISS_PATH = "vectorstore/db_faiss"
12
  loader = CSVLoader(file_path="data/2019.csv", encoding="utf-8", csv_args={'delimiter': ','})
13
  data = loader.load()
@@ -40,6 +44,14 @@ pipe = pipeline("text-generation",model="mistralai/Mistral-7B-v0.1",model_type="
40
 
41
  qa = ConversationalRetrievalChain.from_llm(llm, retriever=docsearch.as_retriever())
42
 
 
 
 
 
 
 
 
 
43
  while True:
44
  chat_history = []
45
  #query = "What is the value of GDP per capita of Finland provided in the data?"
 
1
  import streamlit as st
2
+ from streamlit_chat import message
3
  from langchain.document_loaders.csv_loader import CSVLoader
4
  from langchain.text_splitter import RecursiveCharacterTextSplitter
5
  from langchain.embeddings import HuggingFaceEmbeddings
 
9
  from langchain.chains import ConversationalRetrievalChain
10
  import sys
11
 
12
+ st.title("Chat with csv using Open Source Inference point")
13
+
14
+
15
  DB_FAISS_PATH = "vectorstore/db_faiss"
16
  loader = CSVLoader(file_path="data/2019.csv", encoding="utf-8", csv_args={'delimiter': ','})
17
  data = loader.load()
 
44
 
45
  qa = ConversationalRetrievalChain.from_llm(llm, retriever=docsearch.as_retriever())
46
 
47
+ # Insert a chat message container.
48
+ >>> with st.chat_message("user"):
49
+ >>> st.write("Hello 👋")
50
+ >>> st.line_chart(np.random.randn(30, 3))
51
+
52
+ # Display a chat input widget.
53
+ >>> st.chat_input("Say something")
54
+
55
  while True:
56
  chat_history = []
57
  #query = "What is the value of GDP per capita of Finland provided in the data?"