A professional, modern web application for AI-powered information retrieval and synthesis with advanced text-to-speech capabilities.
- Multi-source Search: Intelligently searches across emails, Slack messages, and documents
- AI-Powered Analysis: Uses Google Gemini AI for query understanding and result synthesis
- Source Attribution: Provides detailed citations and source verification
- Real-time Processing: Fast, responsive search with live status updates
- 12 High-Quality Voices: Multiple English accents (US, UK, AU, CA, IN, IE, ZA, NZ)
- Voice Preview: Test voices before generating full responses
- Speed Control: Adjustable speech speed from 0.5x to 2.0x
- Audio Download: Download responses as MP3 files
- Smart Text Processing: Automatically optimizes text for natural speech
- Modern Design: Clean, professional interface with smooth animations
- Responsive Layout: Works perfectly on desktop, tablet, and mobile
- Interactive Elements: Hover effects, loading states, and smooth transitions
- Real-time Feedback: Live status indicators and progress tracking
- Accessibility: Keyboard navigation and screen reader support
- Gradient Backgrounds: Beautiful color gradients throughout the interface
- Smooth Animations: Fade-in, slide-up, and hover effects
- Professional Typography: Inter font family for optimal readability
- Color-coded Status: Visual indicators for different states
- Card-based Layout: Clean, organized information presentation
- Animated Loading Screen: Professional startup experience
- Dynamic Status Indicators: Real-time system status updates
- Expandable Panels: Collapsible sections for better organization
- Modal Dialogs: Clean popup interfaces for audio playback
- Toast Notifications: Non-intrusive success/error messages
- Python 3.8+
- Google Gemini API key
-
Clone the repository
git clone <repository-url> cd synthetic-memory
-
Install dependencies
pip install -r requirements_flask.txt
-
Configure API key
# Create .streamlit/secrets.toml echo 'GEMINI_API_KEY = "your-api-key-here"' > .streamlit/secrets.toml
-
Run the application
python app.py
-
Open in browser
http://localhost:5000
pip install flask flask-session google-generativeai gtts toml
synthetic-memory/
├── app.py # Main Flask application
├── synthetic_memory.py # Core business logic
├── requirements_flask.txt # Flask dependencies
├── templates/
│ └── index.html # Main HTML template
├── static/
│ ├── css/
│ │ └── style.css # Professional CSS with animations
│ └── js/
│ └── app.js # Interactive JavaScript
├── .streamlit/
│ └── secrets.toml # API configuration
├── emails.json # Sample email data
├── slack_messages.json # Sample Slack data
├── project_notes.txt # Sample document
└── test_flask_app.py # Test script
- Enter your question in the search box
- Click "Find Context" or press Enter
- View AI-generated results with source citations
- Use TTS to listen to responses (optional)
- Expand "Text-to-Speech Settings"
- Select your preferred voice
- Adjust speech speed if needed
- Click "Preview Voice" to test
- Enable TTS for automatic audio generation
Use the pre-built quick query buttons:
- "Project Phoenix Feedback"
- "Budget Concerns"
- "Project Notes"
GET /
- Main application pageGET /api/status
- Application status and data countsGET /api/voices
- Available TTS voices
POST /api/query
- Process search queriesPOST /api/tts
- Generate text-to-speech audioPOST /api/tts/preview
- Preview voice samples
{
"query": "What was the feedback on Project Phoenix?",
"tts_enabled": true,
"voice": "English (US) - Female"
}
{
"success": true,
"query": "What was the feedback on Project Phoenix?",
"search_terms": ["Project Phoenix", "feedback", "review"],
"response": {
"answer": "Based on the data provided...",
"sources": [
{
"id": 1,
"type": "email",
"content_snippet": "The technical approach looks solid...",
"metadata": {
"from": "sarah.chen@company.com",
"date": "2024-03-15"
}
}
]
},
"stats": {
"email_results": 6,
"slack_results": 6,
"document_found": true
}
}
Modify static/css/style.css
to customize:
- Color scheme (CSS variables in
:root
) - Animations and transitions
- Layout and spacing
- Typography and fonts
Extend static/js/app.js
to add:
- New interactive features
- Additional API endpoints
- Custom animations
- Enhanced user experience
Modify app.py
to add:
- New API endpoints
- Additional data sources
- Enhanced processing logic
- Custom error handling
python test_flask_app.py
- Application startup
- API endpoints
- Query processing
- TTS functionality
- Error handling
-
Environment Variables
export GEMINI_API_KEY="your-api-key" export FLASK_ENV="production"
-
WSGI Server
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 app:app
-
Docker (optional)
FROM python:3.9-slim COPY . /app WORKDIR /app RUN pip install -r requirements_flask.txt EXPOSE 5000 CMD ["python", "app.py"]
- Input Validation: All user inputs are validated and sanitized
- API Key Protection: Secure storage in configuration files
- Error Handling: Graceful error handling without information leakage
- Rate Limiting: Built-in protection against abuse
- Fast Response Times: < 2 seconds for typical queries
- Efficient Processing: Optimized search algorithms
- Caching: Session-based caching for improved performance
- Responsive UI: Smooth animations without performance impact
- Professional UI: Modern, polished interface with animations
- Better Performance: Faster loading and more responsive
- Mobile Support: Fully responsive design
- Enhanced TTS: Better voice selection and controls
- Real-time Feedback: Live status updates and progress indicators
- Modular Architecture: Clean separation of concerns
- API-First Design: Easy to extend and integrate
- Production Ready: Proper error handling and logging
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is for educational and demonstration purposes.
For issues and questions:
- Check the test results:
python test_flask_app.py
- Verify API key configuration
- Check browser console for JavaScript errors
- Review Flask application logs
Synthetic Memory Lite - Transforming how you interact with your personal data through AI-powered search and synthesis.