Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -35
src/streamlit_app.py
CHANGED
@@ -134,8 +134,7 @@ Context about you:
|
|
134 |
|
135 |
Instructions:
|
136 |
- Use the context above to inform your responses
|
137 |
-
- If asked about something not covered in the context,
|
138 |
-
- If you're not sure about something specific to your context, say "I'm not sure about that based on what I know about myself"
|
139 |
- Keep responses conversational and natural
|
140 |
- Be helpful and engaging"""
|
141 |
|
@@ -195,7 +194,7 @@ def process_audio(audio_bytes):
|
|
195 |
|
196 |
def main():
|
197 |
st.title("ποΈ Voice Bot")
|
198 |
-
st.markdown("*Talk to
|
199 |
|
200 |
# Initialize session state
|
201 |
init_session_state()
|
@@ -205,6 +204,7 @@ def main():
|
|
205 |
|
206 |
with col1:
|
207 |
st.subheader("π€ Voice Input")
|
|
|
208 |
|
209 |
# Audio recorder
|
210 |
audio_bytes = audio_recorder(
|
@@ -271,39 +271,10 @@ def main():
|
|
271 |
# Context management section
|
272 |
st.divider()
|
273 |
|
274 |
-
with st.expander("
|
275 |
-
st.
|
|
|
276 |
|
277 |
-
# Editable context
|
278 |
-
new_context = st.text_area(
|
279 |
-
"Edit Prakhar's context:",
|
280 |
-
value=st.session_state.context,
|
281 |
-
height=200,
|
282 |
-
help="This context defines who Prakhar is and how he should respond."
|
283 |
-
)
|
284 |
-
|
285 |
-
col1, col2, col3 = st.columns([1, 1, 2])
|
286 |
-
|
287 |
-
with col1:
|
288 |
-
if st.button("πΎ Save Context"):
|
289 |
-
if save_context(new_context):
|
290 |
-
st.session_state.context = new_context
|
291 |
-
st.success("Context saved!")
|
292 |
-
else:
|
293 |
-
st.error("Failed to save context")
|
294 |
-
|
295 |
-
with col2:
|
296 |
-
if st.button("π Reset Context"):
|
297 |
-
default_context = """I am Prakhar, an AI assistant. I can help you with general questions and conversations.
|
298 |
-
I aim to be helpful, harmless, and honest in all my interactions."""
|
299 |
-
st.session_state.context = default_context
|
300 |
-
save_context(default_context)
|
301 |
-
st.rerun()
|
302 |
-
|
303 |
-
with col3:
|
304 |
-
if st.button("ποΈ Clear Conversation"):
|
305 |
-
st.session_state.conversation_history = []
|
306 |
-
st.rerun()
|
307 |
|
308 |
# Status indicators
|
309 |
if st.session_state.processing:
|
|
|
134 |
|
135 |
Instructions:
|
136 |
- Use the context above to inform your responses
|
137 |
+
- If asked about something not covered in the context, say "I'm not sure about that based on what I know about myself"
|
|
|
138 |
- Keep responses conversational and natural
|
139 |
- Be helpful and engaging"""
|
140 |
|
|
|
194 |
|
195 |
def main():
|
196 |
st.title("ποΈ Voice Bot")
|
197 |
+
st.markdown("*Talk to me using your voice!*")
|
198 |
|
199 |
# Initialize session state
|
200 |
init_session_state()
|
|
|
204 |
|
205 |
with col1:
|
206 |
st.subheader("π€ Voice Input")
|
207 |
+
st.write("Audio Recording stops after 2 seconds of silence.")
|
208 |
|
209 |
# Audio recorder
|
210 |
audio_bytes = audio_recorder(
|
|
|
271 |
# Context management section
|
272 |
st.divider()
|
273 |
|
274 |
+
with st.expander("βοΈ Context", expanded=False):
|
275 |
+
st.text_area("Current: ", value=st.session_state.context,
|
276 |
+
height=270,)
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
# Status indicators
|
280 |
if st.session_state.processing:
|