Spaces:
Running
Running
Switch session storage from filesystem to in-memory for HF Spaces compatibility, eliminating permission issues. Update relevant environment variable logging and adjust documentation to reflect changes in session management.
371c595 HF Spaces Data Persistence Fix
Problem
The application was using /tmp/human_notes_evaluator for data storage, which is ephemeral on HF Spaces and gets cleared between requests/restarts.
Solution Applied
Forced persistent DATA_DIR: Changed from environment-dependent to forced persistent location
DATA_DIR = os.path.join(os.getcwd(), 'data') # Always use ./data/Added startup logging: Clear messages showing which directory is being used
IMPORTANT: Using DATA_DIR = /path/to/your/space/dataFixed session storage: Switched from filesystem to in-memory sessions for HF compatibility
# Removed filesystem session config that caused permission errors app.config['SESSION_PERMANENT'] = False # Simple in-memory sessionsEnhanced debugging: Added
/hf-debugroute to diagnose HF-specific issues
Expected Result
- Data will now persist in
./data/directory - Evaluations saved to
./data/evaluations.csv - Sessions stored in-memory (HF Spaces compatible)
- Documents loaded from
./data/documents.csv
How to Verify on HF
- Push these changes to HF Spaces
- Check startup logs - should show
DATA_DIR = /path/to/space/data - Visit
/hf-debugroute to see system info - Test evaluation submission and check results persistence
Key Files Changed
app.py- Main DATA_DIR fix and loggingDEPLOYMENT.md- Deployment instructionsrequirements.txt- Dependencies.gitignore- Exclude data files
Debug Routes
/debug- Full application debug info/hf-debug- HF Spaces specific debugging
Next Steps
- Commit and push to HF Spaces
- Check startup logs for DATA_DIR confirmation
- Upload
documents.csvto the space - Test evaluation workflow
- Use debug routes if issues persist