File size: 3,206 Bytes
6951a91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c143a84
 
6951a91
c143a84
 
 
 
 
 
bdb2281
c143a84
57cc8b6
 
 
c143a84
bdb2281
c143a84
57cc8b6
 
bdb2281
 
 
c143a84
 
 
 
 
 
 
 
57cc8b6
6951a91
 
 
 
 
 
 
 
 
 
 
 
bdb2281
6951a91
 
 
 
 
 
 
a72cf3f
6951a91
a72cf3f
6951a91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from typing import Set

from backend.core import run_llm
import streamlit as st
from streamlit_chat import message
from PIL import Image
from io import BytesIO
import base64

# def add_bg_from_local(image_file):
#     with open(image_file, "rb") as image_file:
#         encoded_string = base64.b64encode(image_file.read())
#     st.markdown(
#     f"""
#     <style>
#     .stApp {{
#         background-image: url(data:{"jpeg"};base64,{encoded_string.decode()});
#         background-size: cover
#     }}
#     </style>
#     """,
#     unsafe_allow_html=True
#     )
# background_image = "bg2.jpeg"
# add_bg_from_local(background_image)

# Load your profile image
profile_image = Image.open("Untitled design.png")

# Display profile image in the sidebar
st.sidebar.image(profile_image, use_column_width=True)

# Add LinkedIn, Github, and LeetCode links with icons
st.sidebar.markdown(
    """
    πŸ’» MS CS @ IUB  

    🧳 Ex Amdocs SDE (3 Years of Experience)

    🎯 Actively looking for full time SDE / SWE / Full Stack / Data Science roles starting immediately     

    πŸ“§ : anujmaha@iu.edu / anujsmahajan1998@gmail.com  

    πŸ’» : Python, React, Java, Javascript, SpringBoot, AWS

    πŸ“ž : +1 8126029653   
      
    🎯 I am a strong Full Stack and Software developer with diverse skills and currently exploring AWS and GenAI.       

    [![](https://content.linkedin.com/content/dam/me/business/en-us/amp/brand-site/v2/bg/LI-Bug.svg.original.svg)](https://www.linkedin.com/in/anujmaha/)   
    [![GitHub](https://img.icons8.com/material-outlined/48/000000/github.png)](https://github.com/anujmahajan98)    
    [Leetocde](https://leetcode.com/anujmah/)    
    """
)

st.header("Get to know Anuj πŸ‘¨πŸ»β€πŸ’»")
st.header("Ask anything about me ")

if "user_prompt_history" not in st.session_state:
    st.session_state["user_prompt_history"] = []

if "chat_answers_history" not in st.session_state:
    st.session_state["chat_answers_history"] = []

if "chat_history" not in st.session_state:
    st.session_state["chat_history"] = []



prompt = st.text_input("Prompt", placeholder="eg. Is it a good choice to hire him as SDE ?, What is his work experience ?...")


if prompt:
    with st.spinner("Generating response..."):
        generated_response = run_llm(
            query=prompt, chat_history=st.session_state["chat_history"]
        )
        
        formatted_response = (
            f"{generated_response['answer']}"
        )

        st.session_state.user_prompt_history.append(prompt)
        st.session_state.chat_answers_history.append(formatted_response)
        st.session_state.chat_history.append((prompt, generated_response["answer"]))

if st.session_state["chat_answers_history"]:
    for generated_response, user_query in zip(
        st.session_state["chat_answers_history"],
        st.session_state["user_prompt_history"],
    ):
        message(
            user_query,
            is_user=True,
            avatar_style="adventurer",
            seed=123,
        )
        # message(generated_response)
        st.write(
            f'<div style="word-wrap: break-word;">{generated_response}</div>',
            unsafe_allow_html=True,
        )