Upload app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
# It provides functions for creating UIs, displaying data, and handling user inputs.
|
3 |
# This module provides a way to interact with the operating system, such as accessing environment variables, working with files
|
4 |
# and directories, executing shell commands, etc
|
5 |
-
import os
|
6 |
|
7 |
import streamlit as st
|
8 |
|
@@ -10,6 +10,7 @@ import streamlit as st
|
|
10 |
# It allows you to store sensitive information or configuration settings separate from your code
|
11 |
# and access them within your application.
|
12 |
from dotenv import load_dotenv
|
|
|
13 |
|
14 |
# Helps us generate embeddings
|
15 |
# An embedding is a vector (list) of floating point numbers. The distance between two vectors measures their relatedness.
|
@@ -31,7 +32,6 @@ st.header("Hey, Ask me something & I will give out similar things")
|
|
31 |
embeddings = OpenAIEmbeddings()
|
32 |
|
33 |
# The below snippet helps us to import CSV file data for our tasks
|
34 |
-
from langchain.document_loaders.csv_loader import CSVLoader
|
35 |
|
36 |
loader = CSVLoader(
|
37 |
file_path="myData.csv",
|
@@ -62,6 +62,7 @@ if submit:
|
|
62 |
docs = db.similarity_search(user_input)
|
63 |
print(docs)
|
64 |
st.subheader("Top Matches:")
|
|
|
65 |
st.text(docs[0])
|
66 |
st.text(docs[1].page_content)
|
67 |
-
st.text(docs[:3]
|
|
|
2 |
# It provides functions for creating UIs, displaying data, and handling user inputs.
|
3 |
# This module provides a way to interact with the operating system, such as accessing environment variables, working with files
|
4 |
# and directories, executing shell commands, etc
|
5 |
+
# import os
|
6 |
|
7 |
import streamlit as st
|
8 |
|
|
|
10 |
# It allows you to store sensitive information or configuration settings separate from your code
|
11 |
# and access them within your application.
|
12 |
from dotenv import load_dotenv
|
13 |
+
from langchain.document_loaders.csv_loader import CSVLoader
|
14 |
|
15 |
# Helps us generate embeddings
|
16 |
# An embedding is a vector (list) of floating point numbers. The distance between two vectors measures their relatedness.
|
|
|
32 |
embeddings = OpenAIEmbeddings()
|
33 |
|
34 |
# The below snippet helps us to import CSV file data for our tasks
|
|
|
35 |
|
36 |
loader = CSVLoader(
|
37 |
file_path="myData.csv",
|
|
|
62 |
docs = db.similarity_search(user_input)
|
63 |
print(docs)
|
64 |
st.subheader("Top Matches:")
|
65 |
+
st.text(docs)
|
66 |
st.text(docs[0])
|
67 |
st.text(docs[1].page_content)
|
68 |
+
st.text([doc.page_content for doc in docs[:3]])
|