Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,11 @@ from langchain.document_loaders.csv_loader import CSVLoader
|
|
| 12 |
# Allow users to upload a CSV file
|
| 13 |
uploaded_file = st.sidebar.file_uploader("Upload your Data", type="csv")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
if uploaded_file:
|
| 16 |
# Initialize the CSVLoader to load the uploaded CSV file
|
| 17 |
import tempfile
|
|
@@ -19,24 +24,16 @@ if uploaded_file:
|
|
| 19 |
tmp_file.write(uploaded_file.getvalue())
|
| 20 |
tmp_file_path = tmp_file.name
|
| 21 |
|
|
|
|
| 22 |
loader = CSVLoader(file_path=tmp_file_path, encoding="utf-8", csv_args={'delimiter': ','})
|
| 23 |
data = loader.load()
|
| 24 |
db.save_local(DB_FAISS_PATH)
|
| 25 |
llm = load_llm()
|
| 26 |
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
-
|
| 30 |
-
st.title("Chat with CSV using open source LLM Inference Point 🦙🦜")
|
| 31 |
-
# Display a markdown message with additional information
|
| 32 |
-
st.markdown("<h3 style='text-align: center; color: white;'>Built by <a href='https://github.com/AIAnytime'>AI Anytime with ❤️ </a></h3>", unsafe_allow_html=True)
|
| 33 |
-
|
| 34 |
-
# Initialize the CSVLoader to load the uploaded CSV file
|
| 35 |
-
data = loader.load()
|
| 36 |
-
db.save_local(DB_FAISS_PATH)
|
| 37 |
-
llm = load_llm()
|
| 38 |
-
|
| 39 |
-
chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
|
| 40 |
|
| 41 |
def conversational_chat(query):
|
| 42 |
# Maintain and display the chat history
|
|
|
|
| 12 |
# Allow users to upload a CSV file
|
| 13 |
uploaded_file = st.sidebar.file_uploader("Upload your Data", type="csv")
|
| 14 |
|
| 15 |
+
# Display the title of the web page
|
| 16 |
+
st.title("Chat with CSV using open source LLM Inference Point 🦙🦜")
|
| 17 |
+
# Display a markdown message with additional information
|
| 18 |
+
st.markdown("<h3 style='text-align: center; color: white;'>Built by <a href='https://github.com/AIAnytime'>AI Anytime with ❤️ </a></h3>", unsafe_allow_html=True)
|
| 19 |
+
|
| 20 |
if uploaded_file:
|
| 21 |
# Initialize the CSVLoader to load the uploaded CSV file
|
| 22 |
import tempfile
|
|
|
|
| 24 |
tmp_file.write(uploaded_file.getvalue())
|
| 25 |
tmp_file_path = tmp_file.name
|
| 26 |
|
| 27 |
+
# Initialize the CSVLoader to load the uploaded CSV file
|
| 28 |
loader = CSVLoader(file_path=tmp_file_path, encoding="utf-8", csv_args={'delimiter': ','})
|
| 29 |
data = loader.load()
|
| 30 |
db.save_local(DB_FAISS_PATH)
|
| 31 |
llm = load_llm()
|
| 32 |
|
| 33 |
+
chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
|
| 34 |
|
| 35 |
|
| 36 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
def conversational_chat(query):
|
| 39 |
# Maintain and display the chat history
|