Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,8 +8,8 @@ load_dotenv()
|
|
| 8 |
|
| 9 |
# Configure Streamlit page settings
|
| 10 |
st.set_page_config(
|
| 11 |
-
page_title="
|
| 12 |
-
page_icon="
|
| 13 |
layout="wide",
|
| 14 |
)
|
| 15 |
|
|
@@ -17,34 +17,16 @@ st.set_page_config(
|
|
| 17 |
st.markdown(
|
| 18 |
"""
|
| 19 |
<style>
|
| 20 |
-
<style>
|
| 21 |
-
/* Set light blue background for the whole page */
|
| 22 |
body, .stApp {
|
| 23 |
background-color: #E3F2FD;
|
| 24 |
}
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
body {
|
| 28 |
-
background-color: #ADD8E6;
|
| 29 |
-
}
|
| 30 |
-
.stTabs [data-baseweb="tab-list"] {
|
| 31 |
-
justify-content: center;
|
| 32 |
-
}
|
| 33 |
-
.stTabs [data-baseweb="tab"] {
|
| 34 |
-
background-color: #E3F2FD;
|
| 35 |
-
border-radius: 20px;
|
| 36 |
-
font-weight: bold;
|
| 37 |
-
color: black;
|
| 38 |
-
padding: 10px;
|
| 39 |
-
}
|
| 40 |
-
.stTabs [data-baseweb="tab"][aria-selected="true"] {
|
| 41 |
-
background-color: #1E90FF;
|
| 42 |
-
color: white;
|
| 43 |
-
border-radius: 20px;
|
| 44 |
-
}
|
| 45 |
h2 {
|
| 46 |
color: #003366;
|
| 47 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
</style>
|
| 49 |
""",
|
| 50 |
unsafe_allow_html=True,
|
|
@@ -74,76 +56,28 @@ if "chat_session" not in st.session_state:
|
|
| 74 |
st.stop()
|
| 75 |
|
| 76 |
# Display chatbot title
|
| 77 |
-
st.title("
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
# Sample interview questions
|
| 84 |
-
interview_questions = {
|
| 85 |
-
"π» Technical": [
|
| 86 |
-
"π₯οΈ Explain Object-Oriented Programming.",
|
| 87 |
-
"π What are the differences between TCP and UDP?",
|
| 88 |
-
"π How does a database index work?",
|
| 89 |
-
"π What is the difference between REST and SOAP?",
|
| 90 |
-
"β‘ Explain Big O notation with an example."
|
| 91 |
-
],
|
| 92 |
-
"π¬ HR & Behavioral": [
|
| 93 |
-
"π£οΈ Tell me about yourself.",
|
| 94 |
-
"πͺ What are your strengths and weaknesses?",
|
| 95 |
-
"π Describe a challenging project you worked on.",
|
| 96 |
-
"π― Why should we hire you?",
|
| 97 |
-
"π
Where do you see yourself in five years?"
|
| 98 |
-
],
|
| 99 |
-
"π§ Aptitude": [
|
| 100 |
-
"π Solve: A train moving at 60 km/hr crosses a 200m bridge in how many seconds?",
|
| 101 |
-
"π’ What is the next number in the sequence: 2, 6, 12, 20, 30, ...?",
|
| 102 |
-
"β° If a clock is 10 minutes fast, how will you correct it?",
|
| 103 |
-
"π A room has 8 corners, each with a cat. How many cats are there in total?",
|
| 104 |
-
"π° Solve: Two pipes can fill a tank in 4 and 6 hours. How long to fill together?"
|
| 105 |
-
],
|
| 106 |
-
"π’ Company-Specific": [
|
| 107 |
-
"π’ What do you know about our company?",
|
| 108 |
-
"β Why do you want to work at Google (or any company)?",
|
| 109 |
-
"π How do you stay updated with the latest technologies?",
|
| 110 |
-
"π What sets you apart from other candidates?",
|
| 111 |
-
"β οΈ Describe a time you handled failure professionally."
|
| 112 |
-
],
|
| 113 |
-
"π DSA": [
|
| 114 |
-
"π What is a linked list? Explain with an example.",
|
| 115 |
-
"π How do you implement a binary search algorithm?",
|
| 116 |
-
"π Explain quicksort and its time complexity.",
|
| 117 |
-
"π― What is dynamic programming and how is it used?",
|
| 118 |
-
"π¦ Describe the difference between a stack and a queue."
|
| 119 |
-
]
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
# Display sample questions under the selected tab
|
| 123 |
-
for i, tab in enumerate(selected_tab):
|
| 124 |
-
with tab:
|
| 125 |
-
st.subheader(f"π {tabs[i]} Questions")
|
| 126 |
-
for question in interview_questions[tabs[i]]:
|
| 127 |
-
st.write(f"- {question}")
|
| 128 |
-
|
| 129 |
-
# Input field for user's message
|
| 130 |
-
user_prompt = st.chat_input("π¬ Ask anything about interview preparation...")
|
| 131 |
-
|
| 132 |
-
if user_prompt:
|
| 133 |
-
# Display the user's message
|
| 134 |
-
st.chat_message("user").markdown(user_prompt)
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
# Send message to Gemini-Pro for response
|
| 137 |
try:
|
| 138 |
-
|
| 139 |
-
f"
|
| 140 |
)
|
| 141 |
|
| 142 |
# Display AI response
|
| 143 |
-
|
| 144 |
-
|
| 145 |
except Exception as e:
|
| 146 |
-
st.error(f"β Error processing your
|
| 147 |
|
| 148 |
|
| 149 |
|
|
|
|
| 8 |
|
| 9 |
# Configure Streamlit page settings
|
| 10 |
st.set_page_config(
|
| 11 |
+
page_title="AI Healthcare Assistant",
|
| 12 |
+
page_icon="π©Ί",
|
| 13 |
layout="wide",
|
| 14 |
)
|
| 15 |
|
|
|
|
| 17 |
st.markdown(
|
| 18 |
"""
|
| 19 |
<style>
|
|
|
|
|
|
|
| 20 |
body, .stApp {
|
| 21 |
background-color: #E3F2FD;
|
| 22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
h2 {
|
| 24 |
color: #003366;
|
| 25 |
}
|
| 26 |
+
.stTextInput, .stButton > button {
|
| 27 |
+
border-radius: 10px;
|
| 28 |
+
font-size: 16px;
|
| 29 |
+
}
|
| 30 |
</style>
|
| 31 |
""",
|
| 32 |
unsafe_allow_html=True,
|
|
|
|
| 56 |
st.stop()
|
| 57 |
|
| 58 |
# Display chatbot title
|
| 59 |
+
st.title("π©Ί AI Healthcare Assistant")
|
| 60 |
+
|
| 61 |
+
st.subheader("Enter your symptoms to get advice and treatment guidance")
|
| 62 |
+
|
| 63 |
+
# User input for symptoms
|
| 64 |
+
user_symptoms = st.text_input("Describe your symptoms (e.g., fever, cough, headache)...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
if st.button("Get Advice") and user_symptoms:
|
| 67 |
+
# Display user input
|
| 68 |
+
st.write(f"**Your Symptoms:** {user_symptoms}")
|
| 69 |
+
|
| 70 |
# Send message to Gemini-Pro for response
|
| 71 |
try:
|
| 72 |
+
response = st.session_state.chat_session.send_message(
|
| 73 |
+
f"A user is experiencing the following symptoms: {user_symptoms}. Provide possible causes, advice, and treatment guidance."
|
| 74 |
)
|
| 75 |
|
| 76 |
# Display AI response
|
| 77 |
+
st.subheader("π©Ί AI Advice & Treatment Guidance:")
|
| 78 |
+
st.markdown(response.text)
|
| 79 |
except Exception as e:
|
| 80 |
+
st.error(f"β Error processing your request: {e}")
|
| 81 |
|
| 82 |
|
| 83 |
|