Spaces:
Build error
Build error
Update tabs.py
Browse files
tabs.py
CHANGED
|
@@ -1 +1,73 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Tab components for the SeniorMatch application."""
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import time
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
from ..agents.crew_manager import get_result
|
| 8 |
+
from ..utils.api_utils import open_ai_chat
|
| 9 |
+
from ..utils.url_utils import is_valid_url, check_url_accessibility, preview_url_content
|
| 10 |
+
|
| 11 |
+
def render_find_activities_tab():
|
| 12 |
+
"""Render the Find Activities tab."""
|
| 13 |
+
st.header("Senior Information")
|
| 14 |
+
st.markdown("Please provide information to help find appropriate activities and resources.")
|
| 15 |
+
|
| 16 |
+
col1, col2 = st.columns(2)
|
| 17 |
+
|
| 18 |
+
with col1:
|
| 19 |
+
age_group = st.text_input("Enter your age")
|
| 20 |
+
zip_code = st.text_input("Enter your zip code")
|
| 21 |
+
|
| 22 |
+
with col2:
|
| 23 |
+
mobility = st.selectbox(
|
| 24 |
+
"Mobility level:",
|
| 25 |
+
["Fully mobile", "Some limitations", "Limited mobility", "Requires assistance"]
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
user_prompt = st.text_area("What activities or interests would you like to explore?", height=100)
|
| 29 |
+
st.caption("Examples: gardening, book clubs, gentle exercise, music, crafts, technology learning")
|
| 30 |
+
|
| 31 |
+
# ... rest of the find activities tab code ...
|
| 32 |
+
|
| 33 |
+
def render_about_tab():
|
| 34 |
+
"""Render the About tab."""
|
| 35 |
+
st.header("About the App")
|
| 36 |
+
|
| 37 |
+
st.markdown("""
|
| 38 |
+
This application helps seniors find activities and resources tailored to their interests,
|
| 39 |
+
mobility levels, and location. It uses AI to search for and recommend appropriate options.
|
| 40 |
+
|
| 41 |
+
### Features:
|
| 42 |
+
|
| 43 |
+
- **Activity Search**: Find social activities, volunteer opportunities, and community resources
|
| 44 |
+
- **Personalized Recommendations**: Results tailored to your age, mobility level, and location
|
| 45 |
+
- **Knowledge Base**: Upload documents about local resources to enhance search results
|
| 46 |
+
- **Wellness Tips**: Get additional health and wellness suggestions
|
| 47 |
+
""")
|
| 48 |
+
|
| 49 |
+
# ... rest of the about tab code ...
|
| 50 |
+
|
| 51 |
+
def render_url_preview_tab():
|
| 52 |
+
"""Render the URL Preview tab."""
|
| 53 |
+
st.header("URL Content Preview")
|
| 54 |
+
st.markdown("Preview the content from URLs before adding them to your knowledge base.")
|
| 55 |
+
|
| 56 |
+
preview_url = st.text_input("Enter a URL to preview")
|
| 57 |
+
|
| 58 |
+
if st.button("Preview Content") and preview_url:
|
| 59 |
+
# ... URL preview tab code ...
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
def render_tabs():
|
| 63 |
+
"""Render all tabs in the application."""
|
| 64 |
+
tab1, tab2, tab3 = st.tabs(["Find Activities", "About the App", "URL Preview"])
|
| 65 |
+
|
| 66 |
+
with tab1:
|
| 67 |
+
render_find_activities_tab()
|
| 68 |
+
|
| 69 |
+
with tab2:
|
| 70 |
+
render_about_tab()
|
| 71 |
+
|
| 72 |
+
with tab3:
|
| 73 |
+
render_url_preview_tab()
|