Jawad138 commited on
Commit
abb41df
·
1 Parent(s): 9c7beb9

update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -51,12 +51,23 @@ def create_conversational_chain(vector_store):
51
  replicate_api_token = "r8_AA3K1fhDykqLa5M74E5V0w5ss1z0P9S3foWJl" # Replace with your actual token
52
  os.environ["REPLICATE_API_TOKEN"] = replicate_api_token
53
 
54
- print("Length of text_chunks:", len(text_chunks))
55
- print("Content of text_chunks:", text_chunks)
56
-
57
- print("Length of embeddings:", len(embeddings))
58
- print("Content of embeddings:", embeddings)
59
-
 
 
 
 
 
 
 
 
 
 
 
60
  llm = Replicate(
61
  streaming=True,
62
  model="replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781",
@@ -72,6 +83,7 @@ def create_conversational_chain(vector_store):
72
  return chain
73
 
74
 
 
75
  def main():
76
  initialize_session_state()
77
  st.title("Chat With Your Doc")
 
51
  replicate_api_token = "r8_AA3K1fhDykqLa5M74E5V0w5ss1z0P9S3foWJl" # Replace with your actual token
52
  os.environ["REPLICATE_API_TOKEN"] = replicate_api_token
53
 
54
+ # Add debugging statements
55
+ st.write("Text chunks lengths:", [len(chunk) for chunk in text_chunks])
56
+ st.write("Text chunks content:", text_chunks)
57
+
58
+ # Create embeddings
59
+ st.write("Creating embeddings...")
60
+ embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2",
61
+ model_kwargs={'device': 'cpu'})
62
+
63
+ # Add debugging statements
64
+ st.write("Embeddings lengths:", [len(emb) for emb in embeddings])
65
+ st.write("Embeddings content:", embeddings)
66
+
67
+ vector_store = FAISS.from_documents(text_chunks, embedding=embeddings)
68
+
69
+ st.write("Creating conversation chain...")
70
+
71
  llm = Replicate(
72
  streaming=True,
73
  model="replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781",
 
83
  return chain
84
 
85
 
86
+
87
  def main():
88
  initialize_session_state()
89
  st.title("Chat With Your Doc")