# import os # import faiss # import streamlit as st # import pickle # import time # import numpy as np # from langchain.chains import RetrievalQA # from langchain.text_splitter import RecursiveCharacterTextSplitter # from langchain.document_loaders import UnstructuredURLLoader # #from langchain.vectorstores import FAISS # from langchain_community.vectorstores import FAISS # from langchain_huggingface import HuggingFaceEndpoint # from sentence_transformers import SentenceTransformer # from langchain.embeddings import HuggingFaceEmbeddings # #from langchain import HuggingFaceHub # from langchain_community.llms import HuggingFaceHub # from dotenv import load_dotenv # # splitter = RecursiveCharacterTextSplitter( # # chunk_size=100, # Maximum size of each chunk # # chunk_overlap=20, # Overlap between chunks # # separators=[".", "\n",] # # # The order of separators: first split by double newlines, then single newlines, then spaces, and finally characters # # ) # # # Split the text into chunks # # chunks = splitter.split_text(data) # # model = SentenceTransformer("thenlper/gte-large")#'sentence-transformers/paraphrase-MiniLM-L12-v2') # # embeddings = [model.encode(chunk) for chunk in chunks] # # # 3. Create a FAISS index and add the embeddings # # dimension = len(embeddings[0]) # Dimension of the embeddings # # index = faiss.IndexFlatL2(dimension) # L2 distance index # # embeddings_np = np.array(embeddings).astype('float32') # Convert to numpy array # # index.add(embeddings_np) # # with open('faiss_index.pkl', 'wb') as f: # # pickle.dump(index, f) # # with open('chunks.pkl', 'wb') as f: # # pickle.dump(chunks, f) # with st.sidebar: # st.image("sriram.jpg", caption="Say cheese :)", use_container_width=True) # load_dotenv() # # st.title("Sriram’s Q Reflections 🔎") # # #st.sidebar.title("Article URLs") # # # urls=[] # # # for i in range(3): # # # url=st.sidebar.text_input(f"URL {i+1}") # # # urls.append(url) # # # process_url_clicked=st.sidebar.button("Process URLs") # file_path="faiss_index.pkl" # chunk_path="chunks.pkl" # placeholder=st.empty() # temp=st.empty() # query=placeholder.text_input("Search for a Memory :") # submit=st.button("Recall it") # if query: # # data="November 4 to 8, 2024, was an amazing week. We completed the IDP and presented our work through a demo. Congratulations to the entire team for their efforts. Saying goodbye to Priyansh was bittersweet, but we wish him success in his future journey.\nNovember 4 to 8, 2024, marked the time to wrap everything up.\n\nOctober 28 to November 1, 2024, was a usual week, but we were fully immersed in the Diwali spirit. Wishing everyone a happy and prosperous Diwali. Also, happy Karnataka Rajyotsava.\nOctober 21 to 25, 2024, saw no major updates due to the rain.\nOctober 14 to 18, 2024, was a busy week as I adjusted to Ashwin's departure, but I am getting the hang of it.\n\nSeptember 30 to October 1, 2024, was a great week. I visited Chennai for a successful client meeting. The entire team will be coming to Bangalore next week, and I am excited.\nSeptember 23 to 28, 2024, was a usual week, but we were preparing for a client visit to Chennai next week.\nSeptember 16 to 20, 2024, included a long Friday, as it was Dudhe's last day. Wishing him all the best.\nSeptember 9 to 13, 2024, was a usual week without any major updates. Enjoyed the weekend.\nSeptember 2 to 6, 2024, was a usual week as well, but sending wishes for a happy Ganesh Chaturthi. Ganapathi Bappa Moraya!\n\nJuly 29 to August 2, 2024, was uneventful. Wishing everyone a happy weekend.\nJuly 22 to 26, 2024, was a typical week. Time is flying, and we are already at the end of July.\nJuly 15 to 19, 2024, was a usual week, although I was sick for two days. Travelers to the Western Ghats were advised to be cautious due to rain.\nJuly 1 to 5, 2024, involved starting new threads, which was both exciting and challenging. I also had to take an unplanned day off due to personal commitments.\n\nMay 20 to 24, 2024, was a usual work week with nothing out of the ordinary.\nMay 13 to 17, 2024, was a typical week, but there was crazy traffic on Thursday. I’m hoping the metro line near my home gets built soon.\nMay 6 to 10, 2024, was a short work week due to a couple of days off. Two colleagues had accidents, and I’m hoping they recover soon.\n\nApril 29 to May 3, 2024, brought the much-awaited rain to Bangalore! Looking forward to more.\nApril 15 to 19, 2024, was a week spent waiting for rain in Bangalore, as the summer had been brutal.\nApril 8 to 12, 2024, was a usual work week, but a bit more relaxing with Google Next approaching.\nApril 1 to 5, 2024, was a regular work week, with lots of things happening in each thread.\n\nMarch 25 to 29, 2024, was a bittersweet week as we saw Harshal go. Wishing him all the best in his future endeavors.\nMarch 18 to 22, 2024, introduced a new performance management platform, which will be implemented twice a year.\nMarch 11 to 15, 2024, was a usual week with no major changes, just ongoing work.\nMarch 4 to 8, 2024, was a bit of a catch-up week after being off the previous week. Otherwise, it was a typical work week.\n\nFebruary 19 to 23, 2024, was filled with lots of meetings. I need to focus on completing some smaller tasks.\nFebruary 12 to 16, 2024, saw my commute to the office becoming routine, no longer bothering me.\nFebruary 5 to 9, 2024, was a quiet week with not much to report, although the weather was a bit strange.\n\nJanuary 29 to February 2, 2024, was a usual work week with no big plans for the weekend.\nJanuary 22 to 26, 2024, was a typical work week, and the good news was that parking fees were removed.\nJanuary 15 to 19, 2024, was a week where I took the metro to work, and it turned out to be the same travel time as driving or biking.\nJanuary 8 to 12, 2024, brought new parking fees for office parking, so public transport might be the better option.\nJanuary 1 to 5, 2024, was a great start to the new year, filled with enthusiasm and passion. It was nice to be back at the office and meet the bigger team.\n\n\nDecember 25 to 29, 2023: Ended the year on a great note with notable tech changes. Big thanks to the team for their outstanding support and coordination. Wishing everyone a Happy New Year!\nDecember 18 to 22, 2023: Focused on delivering a Baioniq demo to Asif, which was well-received.\nDecember 11 to 15, 2023: Worked intensely in preparation for the Baioniq demo on the 19th. Hoping for a positive outcome!\nDecember 4 to 8, 2023: A busy and eventful week with many tasks and activities.\n\nNovember 27 to December 1, 2023: Had an engaging visit to Transcell lab. Bangalore weather added some humor to the trip—more like a rainy season than winter.\nNovember 13 to 17, 2023: Regular workweek with plans to visit Transcell lab the following week.\nNovember 6 to 10, 2023: A typical workweek, with a festive celebration—Happy Diwali!\n\nOctober 30 to November 3, 2023: Regular workweek with a return to the office after a long while.\nOctober 23 to 27, 2023: Focused on task planning, which was moved to QA, while preparing for next week's work at DART.\nOctober 16 to 20, 2023: Routine workweek coinciding with a long weekend for many—enjoy! Wishing everyone a Happy Dasara!\nOctober 9 to 13, 2023: Usual workweek highlighted by the successful completion of task planning integration. Kudos to the team for their great work!\nOctober 2 to 6, 2023: Short workweek due to a two-day break, with a new joinee scheduled to start the following week.\n\n\nSeptember 25 to 29, 2023: A dynamic week focused on Baioniq, with the successful integration of Phase 2 and 3 for task planning. Looking forward to the long weekend ahead, with some travel plans.\nSeptember 18 to 22, 2023: Celebrated Ganesh Chaturthi with great festive spirit while keeping work on track.\nSeptember 11 to 15, 2023: An eventful week with the conclusion of AIMM, and the successful deployment of task planning Phase 1 for Baioniq.\nSeptember 4 to 8, 2023: A productive week dedicated to brainstorming and finalizing task planning for Baioniq.\n\n\nAugust 28 to September 1, 2023: Apologies for missing the diary entry. The upcoming roadmap for Baioniq is the main focus this week.\nAugust 21 to 25, 2023: A hectic week at work with FinOps integration, discussions on Marketcheck, and the SDQ upgrade deployment for Baioniq. Excited about the upcoming Google Next event and thrilled by Chandrayaan 3's safe landing on the moon—a reason to celebrate!\nAugust 14 to 18, 2023: Preparing for Baioniq's deployment next week and eagerly anticipating the Google Next event.\nAugust 7 to 11, 2023: A regular work week with a focus on the upcoming Chandrayaan 3's safe landing.\n\nJuly 31 to August 4, 2023: A dynamic week with several Baioniq tasks progressing well. My personal life was relatively uneventful.\nJuly 24 to 28, 2023: A standard work week with a focus on task planning. No major plans for the weekend.\nJuly 17 to 21, 2023: Took the first half of the week off and traveled to Mahabaleshwar for a refreshing and fun trip. At work, I gave a demo to Baioniq stakeholders, which was well received. It was also a bittersweet moment as Satyam announced his departure—wishing him all the best!\nJuly 10 to 14, 2023: Proud of the Baioniq-QueryFy team for pushing a stable version to QA. Kudos to Ankit, Ayush, and Krishna! Looking forward to the demo with Asif and other stakeholders. Took the first half of the following week off for a trip to Mahabaleshwar.\nJuly 3 to 7, 2023: A usual work week, with a funny coincidence—Sid and I were both at Lepakshi at a two-hour difference.\n\nJune 26 to 30, 2023: Trakstars are back, though the question remains—why every three months? \nJune 19 to 23, 2023: A fulfilling week giving the Baioniq-QueryFy demo to internal stakeholders. Thanks to Ayush, Ankit, and Krishna for their great work. The weekend was as usual. \nJune 12 to 16, 2023: I received my promotion letter and am thankful to Satyam, Ashwin, and Dan for their recommendations. I'm grateful to the whole team for their continuous support—big thanks to everyone! \nJune 5 to 9, 2023: A typical workweek with no major events. The weekend was filled with chores.\n\nMay 29 to June 2, 2023: Returned to the office after a month and encountered heavy traffic.\nMay 22 to 26, 2023: Settling into the new house—dealing with the frustration of unreliable internet providers.\nMay 15 to 19, 2023: Had a productive workweek and prepared for the move to a new house over the weekend. Felt disappointed by the 2023 Karnataka election results.\nMay 8 to 12, 2023: Routine week, traveled to my hometown to cast my vote. The election results were eagerly anticipated.\nMay 1 to 5, 2023: A productive week with clarity achieved on the QueryFy and Baioniq integration. Looking forward to PS 2 over the weekend.\n\nApril 24 to 28, 2023: Took a much-needed long weekend and traveled to Mysore to pick up some items. Excited about the release of PS 2 and eager to watch it. \nApril 17 to 21, 2023: Experienced unusually hot weather in Bangalore and was hoping for some April showers. Pleased to see QueryFy collaborating with Baioniq. \nApril 10 to 14, 2023: Sent best wishes for Ashwin's anniversary—many congratulations! Celebrated the new year with good spirits—Happy New Year! \nApril 3 to 7, 2023: Relieved to find a nice house in a good location. Started a hybrid work schedule with two days per week at the office. \n\nMarch 27 to 31, 2023: Received approval for QueryFY and buy-in from HCLS, which was a significant milestone and brought a lot of excitement. Continued house hunting. \nMarch 20 to 24, 2023: Visited the office twice this week in preparation for the upcoming hybrid schedule. Experienced a funny incident of accidentally dropping my keys in the lift, with help from the maintenance guy to retrieve them. \nMarch 13 to 17, 2023: Enjoyed a fantastic D5 event, thanks to Ashwin and Aman for their great organization efforts. \nMarch 6 to 10, 2023: Focused on brainstorming a new roadmap for QiH and discussing ideas for the D5 event in Mumbai the following week. Excited about meeting everyone. \n\nFebruary 27 to March 3, 2023: Planning to catch up with friends over the weekend, as it has been a while. Otherwise, it was a typical work week. \nFebruary 20 to 24, 2023: Had a short workweek due to attending a cousin's wedding. The summer heat was already noticeable. \nFebruary 13 to 17, 2023: Focused on closing the PLC this week, with continued efforts to improve results. Prepared for some weekend travel. \nFebruary 6 to 10, 2023: Reached the maximum potential with the PLC and prepared for deployment to production. There might be plans to revisit this later. \n\nJanuary 30 to February 3, 2023: Focused on strategies for improving PLC results. \nJanuary 23 to 27, 2023: Enjoyed a relaxing long weekend and celebrated Republic Day. \nJanuary 16 to 20, 2023: Said farewell to Gaurav and Aishwarya on their last working day. They were incredible teammates and will be missed. \nJanuary 9 to 13, 2023: Planned a trip to Mysore for the weekend. Best wishes for Sankranthi, Pongal, and Lohri celebrations! \nJanuary 2 to 6, 2023: Reconnected with Mr. Sreedhar, an old colleague, at the office. Entering the new year with many aspirations and determination.\n\nDecember 26 to 30, 2022: Wrapped up 2022 on a joyous note by getting married and moving back to Bangalore. Wishing everyone a happy New Year! \nDecember 19 to 23, 2022: Wished everyone a Merry Christmas and received a Secret Santa gift. Took precautions with the mask mandate announced for safe travel. \nDecember 12 to 16, 2022: Exhausted after a busy wedding weekend, decided to take a break from travel. Continued work on improving PLC results despite facing challenges, maintaining hope for better outcomes. \n\nNovember 28 to December 2, 2022: A routine week with no significant highlights. \nNovember 21 to 25, 2022: Welcomed Ashwin and hosted guests over a busy weekend. Anticipating a more relaxed weekend ahead. \nNovember 14 to 18, 2022: Incorrectly assumed Wednesday traffic would be manageable, but Bangalore traffic proved to be consistently difficult. An all-hands meeting provided clarity on the future direction and scope of work. \nNovember 7 to 11, 2022: Faced challenging commutes to the office, considering getting a bike to make travel time more manageable. \n\nOctober 31 to November 4, 2022: Moved to Bangalore and spent the weekend sorting out logistics. Work is going well, though uncertain about how things will evolve. \nOctober 24 to 28, 2022: Had a short work week, with everything on track as PLC is nearing completion. Preparing for the move to Bangalore from peaceful Mysore. \nOctober 17 to 21, 2022: Released QCaps for QIH, which felt rewarding. UAT went smoothly. Diwali celebrations were filled with good food and enjoyment. \nOctober 10 to 14, 2022: Preparing for the big QCaps release next week. Also gearing up for the move to Bangalore at the end of the month, with plenty of shifting work to be done. \nOctober 3 to 7, 2022: Successfully gave a QCaps demo to Asif, with positive feedback for the team. Celebrated Dasara in Mysore, enjoying the festive lights and atmosphere.\n\nSeptember 26 to 30, 2022: A productive week as PLC neared completion. Celebrated Navratri in Mysore, which added to the charm of the beautiful city. \nSeptember 19 to 23, 2022: Adjusting to life after D5, which passed in a blur. Looking forward to reconnecting with the team. \nSeptember 12 to 16, 2022: Had a fantastic time in Mumbai with the team. Highlights of D5 included a hackathon, team-building activities, a town hall, group discussions, and innovative awards. Special thanks to the organizing team for making it a success! \nSeptember 5 to 9, 2022: Juggling three different threads, with D5 approaching the following week. Excited to meet everyone in person.\n\nAugust 29 to September 2, 2022: A short work week with little of note. \nAugust 22 to 26, 2022: Unusual weather led to many getting sick. \nAugust 15 to 19, 2022: The heavy workload was starting to take a toll, realizing the need to manage better. \nAugust 8 to 12, 2022: Juggling three different projects, a bit hectic. Wishing everyone a happy Independence Day! \nAugust 1 to 5, 2022: Struggling with constant context switching at work, but hopeful that things will stabilize. Mehta is leaving, which is bittersweet, but wishing him all the best.\n\nJuly 25 to 29, 2022: Returned from a long holiday and got married. Managed work activities smoothly despite the personal events.\n\nJune 27 to July 1, 2022: Getting married next week, taking a long break. This marks the last diary entry as a bachelor. \nJune 20 to 24, 2022: Feeling a bit unsure about writing anything, lacked patience this week. \nJune 13 to 17, 2022: Successfully streamlined QCaps and Qognition, which was a huge relief. \nJune 6 to 10, 2022: A very hectic week, too tired to write much.\n\nMay 30 to June 3, 2022: A tough week filled with confusion while trying to finalize between QCaps and Qognition. \nMay 23 to 27, 2022: The ongoing debate between QCaps and Qognition continues, with no resolution yet. \nMay 16 to 20, 2022: Making progress with finalizing the vision and features for Qognition, a positive development. Meanwhile, revenue forecasting goes back to development with new goals. \nMay 9 to 13, 2022: A week full of confusion, aligning Qognition’s vision with QCaps. Hoping for a resolution next week. \nMay 2 to 6, 2022: A short work week, but things are mostly on track with Qognition. Looking forward to a cadence call with Asif next week to finalize next steps.\n\nApril 25 to 29, 2022: Feeling unhappy about the QiH reorganization but hoping it's for a greater purpose. \nApril 18 to 22, 2022: Changes underway at Picksmart, while work on Qognition continues. \nApril 11 to 15, 2022: A short work week, needing to realign thoughts regarding Qognition. \nApril 4 to 8, 2022: Traveled during the week, with the summer heat making it challenging. Picksmart requires alignment for MVP 1, and some members of the Qognition ML team are retiring.\n\nMarch 28 to April 1, 2022: It was a hectic week focusing on streamlining various tasks. \nMarch 21 to 25, 2022: Focused on connecting dots for Qognition MVP2, with plans to pick up the pace next week. \nMarch 14 to 18, 2022: Qognition MVP2 got off the ground with ideation and brainstorming sessions. Picksmart is also shaping up well. Wishing everyone a Happy Holi! \nMarch 7 to 11, 2022: Had a successful Qognition demo with Reghu, with plenty of work lined up for MVP2.\n\nFebruary 28th - March 4th, 2022: Successfully completed a Qognition demo with Kamal, feeling proud of the team's efforts. \nFebruary 21st - 25th, 2022: Excitement building for the Qognition release scheduled for next week—it's a major milestone for the team. \nFebruary 14th - 18th, 2022: Adding features for Qognition MVP 1 and making good progress. Picksmart project also kicked off this week. \nFebruary 7th - 11th, 2022: Missed writing the diary, as I celebrated my birthday on Sunday.\n\nJanuary 31st - February 4th, 2022: A normal work week, time feels like it’s flying by. \nJanuary 24th - 28th, 2022: Finally recovered from COVID, and work is going well. Looking forward to the new activities starting next week. \nJanuary 17th - 21st, 2022: Still recovering from COVID, but work is progressing smoothly, with CVAT integration by the Qognition team. \nJanuary 10th - 14th, 2022: Preparing for the Qognition release, which is just a month or two away, and focusing on various ML activities. \nJanuary 3rd - 7th, 2022: Struggling to write the diary, and realized I only managed six lines—new record!\n\nDecember 27th - 31st, 2021: Relaxed work week, looking forward to 2022. Happy New Year! \nDecember 20th - 24th, 2021: Short of ideas for the diary, reminded everyone to write theirs. Merry Christmas! \nDecember 13th - 17th, 2021: Short week, activities going as planned. Happy weekend! \nDecember 6th - 10th, 2021: Great progress in Qognition, Revenue forecasting finishing soon.\n\nNovember 29th - Dec 3rd, 2021: Revenue forecasting converging nicely. \nNovember 22nd - Nov 26th, 2021: Nothing much to write. \nNovember 15th - Nov 19th, 2021: Good improvement in revenue forecasting. \nNovember 08th - Nov 12th, 2021: Correct build push delayed is better than incorrect build push at the right time. \nNovember 01st - Nov 05th, 2021: Need to spare time for personal development.\n\nOctober 25th - Oct 29th, 2021: Realized the benefit of having Zen day. \nOctober 18th - Oct 22nd, 2021: Interesting progress with Qognition MVP planning, Revenue forecasting aligning well. \nOctober 11th - Oct 14th, 2021: Happy about CDP deliverables, short work week. \nOctober 04th - Oct 08th, 2021: Interesting week, good progress in work.\n\nSeptember 27th - Oct 01st, 2021: Lots of meetings, need to finish backlogs over the weekend. \nSeptember 20th - Sep 24th, 2021: Nothing much to write. \nSeptember 13th - Sep 17th, 2021: Documentation is crucial for proper continuity. \nSeptember 06th - Sep 09th, 2021: Short work week, celebrations ongoing.\n\nAugust 16th - Aug 20th, 2021: First week at Quantiphi, onboarding formalities. Working with the team, great getting to know the work. \nAugust 23rd - Aug 27th, 2021: Exploring a lot, really motivating. \nAugust 30th - Sep 03rd, 2021: Happy with the pace of work." # # splitter = RecursiveCharacterTextSplitter( # # chunk_size=100, # Maximum size of each chunk # # chunk_overlap=20, # Overlap between chunks # # separators=[".", "\n","\n\n"] # # #The order of separators: first split by double newlines, then single newlines, then spaces, and finally characters # # ) # # # Split the text into chunks # # chunks = splitter.split_text(data) # # model = SentenceTransformer("thenlper/gte-large")#'sentence-transformers/paraphrase-MiniLM-L12-v2') # # embeddings = [model.encode(chunk) for chunk in chunks] # # # 3. Create a FAISS index and add the embeddings # # dimension = len(embeddings[0]) # Dimension of the embeddings # # index = faiss.IndexFlatL2(dimension) # L2 distance index # # embeddings_np = np.array(embeddings).astype('float32') # Convert to numpy array # # index.add(embeddings_np) # # with open('faiss_index.pkl', 'wb') as f: # # pickle.dump(index, f) # # with open('chunks.pkl', 'wb') as f: # # pickle.dump(chunks, f) # # with open("chunks.pkl", "rb") as file: # # st.download_button( # # label="Download chunks.pkl file", # # data=file, # # file_name="chunks.pkl", # # mime="application/octet-stream", # # ) # # with open("faiss_index.pkl", "rb") as file: # # st.download_button( # # label="Download faiss.pkl file", # # data=file, # # file_name="faiss_index.pkl", # # mime="application/octet-stream", # # ) # temp.text("Searching for memories..!") # if os.path.exists(file_path): # with open(file_path,'rb') as f: # index=pickle.load(f) # with open(chunk_path,'rb') as f: # chunks=pickle.load(f) # model = SentenceTransformer("thenlper/gte-large")#'sentence-transformers/paraphrase-MiniLM-L12-v2') # temp.text("Searching for memories..!") # query_embedding = model.encode(query).astype('float32').reshape(1, -1) # Encode the query # k = 6 # Number of nearest neighbors to retrieve # distances, indices = index.search(query_embedding, k) # retrieved_chunks = [chunks[i] for i in indices[0]] # # # Use a prompt to generate a response with your language model # # input_prompt = f"""Given the question and # # context, Understand the question and give answer based on the context passed. # # Question: {query}\nContext: {context}\n Answer: """ # # response = llm.invoke(input_prompt) # Replace with your LLM call # # text=response # if query or submit: # st.header("Q Memories :") # temp.text("Memories retrieved..!") # cleaned_text_list = [] # for item in retrieved_chunks: # item = item.strip() # item = item.replace(" .", ".").replace("\n", " ") # item = item.lstrip(". ").strip() # item+="." # cleaned_text_list.append(item) # temp.empty() # for item in cleaned_text_list: # st.write(item) # # start_index = text.find("\nHelpful Answer:") # # # Extract everything after "\nHelpful Answer:" if it exists # # if start_index != -1: # # parsed_text =text[start_index + len("\nHelpful Answer:"):] # # parsed_text = parsed_text.strip() # Optionally strip any extra whitespace # # if query or submit: # # st.header("Answer :") # # st.write(parsed_text) # st.markdown(""" #
# Developed by Aditya Hariharan #
# """, unsafe_allow_html=True) # import os # import faiss # import streamlit as st # import pickle # import time # import numpy as np # from langchain.chains import RetrievalQA # from langchain.text_splitter import RecursiveCharacterTextSplitter # #from langchain.vectorstores import FAISS # from langchain_community.vectorstores import FAISS # from langchain_huggingface import HuggingFaceEndpoint # from sentence_transformers import SentenceTransformer # from langchain.embeddings import HuggingFaceEmbeddings # #from langchain import HuggingFaceHub # from langchain_community.llms import HuggingFaceHub # from dotenv import load_dotenv # # Custom CSS for styling Streamlit app # st.markdown( # """ # # """, # unsafe_allow_html=True # ) # with st.sidebar: # st.image("sriram.jpg", caption="Say cheese :)", use_container_width=True) # st.title("Sriram’s Q Reflections 🔎📖") # # File paths # file_path = "faiss_index.pkl" # chunk_path = "chunks.pkl" # # Text input with custom class for styling # query = st.text_input("Search for a Memory:", placeholder="Enter a memory or keyword", key="custom_input", help="Type here", label_visibility="visible") # submit = st.button("Recall it") # # Create a placeholder for the "Searching for memories..." message # searching_placeholder = st.empty() # if query: # # Display "Searching for memories..." message # searching_placeholder.info("Searching for memories...!") # # Load FAISS index and chunks if the files exist # if os.path.exists(file_path) and os.path.exists(chunk_path): # with open(file_path, 'rb') as f: # index = pickle.load(f) # with open(chunk_path, 'rb') as f: # chunks = pickle.load(f) # # Load embedding model # model = SentenceTransformer("thenlper/gte-large") # query_embedding = model.encode(query).astype('float32').reshape(1, -1) # distances, indices = index.search(query_embedding, k=6) # Retrieve top 6 matches # retrieved_chunks = [chunks[i] for i in indices[0]] # # Clean and format the retrieved memories # st.header("Q Memories:") # cleaned_text_list = [ # item.strip().replace(" .", ".").replace("\n", " ").lstrip(". ").strip() + "." # for item in retrieved_chunks # ] # # Clear the "Searching for memories..." message once results are ready # searching_placeholder.empty() # # Display the memories in styled boxes # col1, col2 = st.columns(2) # Two-column layout for display # for i, item in enumerate(cleaned_text_list): # with col1 if i % 2 == 0 else col2: # st.markdown( # f""" #{item}
#Sriram, you’ve been an exceptional mentor and a true inspiration. Your jolly personality, unmatched intelligence, and brilliant reasoning skills have always stood out. I’m incredibly thankful that you recognized my potential and gave me the opportunity to start my journey as a Machine Learning Engineer. Your belief in me not only gave me the confidence to pursue my passion but also helped me grow immensely. Thank you for your unwavering guidance and support. As you move forward, I wish you nothing but the best in all your future endeavors. Let’s stay in touch, and I’ll always appreciate everything you’ve done for me!
{item}
Developed by Aditya Hariharan
""", unsafe_allow_html=True)