Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,20 +14,7 @@ load_dotenv()
|
|
14 |
|
15 |
|
16 |
|
17 |
-
|
18 |
-
def read_csv_file(file):
|
19 |
-
"""Reads the contents of a CSV file."""
|
20 |
-
if not file:
|
21 |
-
return None
|
22 |
-
data = []
|
23 |
-
try:
|
24 |
-
with file.streamlit_file_uploader("Choose a CSV file", type="csv") as uploaded_file:
|
25 |
-
for row in uploaded_file.getvalue().decode("utf-8").splitlines():
|
26 |
-
data.append(row.split(","))
|
27 |
-
except Exception as e:
|
28 |
-
st.error(f"Error reading CSV file: {e}")
|
29 |
-
return None
|
30 |
-
return data
|
31 |
|
32 |
|
33 |
|
@@ -44,7 +31,7 @@ if uploaded_file is not None:
|
|
44 |
df = pd.read_csv(uploaded_file)
|
45 |
|
46 |
# Show the contents of the CSV file in the main area
|
47 |
-
st.write(df)
|
48 |
else:
|
49 |
# Hide everything else until a file is uploaded
|
50 |
st.warning('Upload a CSV file to get started.')
|
@@ -183,14 +170,14 @@ for message in st.session_state.messages:
|
|
183 |
|
184 |
|
185 |
# Accept user input
|
186 |
-
if prompt := st.chat_input(f"Hi I'm {selected_model},
|
187 |
|
188 |
# Display user message in chat message container
|
189 |
with st.chat_message("user"):
|
190 |
st.markdown(prompt)
|
191 |
# Add user message to chat history
|
192 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
193 |
-
|
194 |
|
195 |
# Display assistant response in chat message container
|
196 |
with st.chat_message("assistant"):
|
|
|
14 |
|
15 |
|
16 |
|
17 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
|
20 |
|
|
|
31 |
df = pd.read_csv(uploaded_file)
|
32 |
|
33 |
# Show the contents of the CSV file in the main area
|
34 |
+
#st.write(df)
|
35 |
else:
|
36 |
# Hide everything else until a file is uploaded
|
37 |
st.warning('Upload a CSV file to get started.')
|
|
|
170 |
|
171 |
|
172 |
# Accept user input
|
173 |
+
if prompt := st.chat_input(f"Hi I'm {selected_model}, ready for a short interview?"):
|
174 |
|
175 |
# Display user message in chat message container
|
176 |
with st.chat_message("user"):
|
177 |
st.markdown(prompt)
|
178 |
# Add user message to chat history
|
179 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
180 |
+
st.session_state.messages.append({"role": "system", "content": "Ask the user questions related to his well being and mental health."})
|
181 |
|
182 |
# Display assistant response in chat message container
|
183 |
with st.chat_message("assistant"):
|