DocUA's picture
Changes have been made to `app.py` to run isolated sessions, and `lifestyle_profile.json` has been updated with new patient data. All changes are aimed at improving patient health management and ensuring data security.
177e0c5
#!/usr/bin/env python3
"""
Session-isolated app.py for HuggingFace Spaces deployment
Ensures each user gets their own isolated app instance
"""
import os
from dotenv import load_dotenv
from gradio_interface import create_session_isolated_interface
load_dotenv()
def create_app():
"""Creates session-isolated Gradio app for Hugging Face Space"""
return create_session_isolated_interface()
if __name__ == "__main__":
if not os.getenv("GEMINI_API_KEY"):
print("⚠️ GEMINI_API_KEY not found in environment variables!")
print("For local run, create .env file with API key")
demo = create_session_isolated_interface()
is_hf_space = os.getenv("SPACE_ID") is not None
if is_hf_space:
print("πŸ” **SESSION ISOLATION ENABLED**")
print("βœ… Each user gets private, isolated app instance")
print("βœ… No data mixing between concurrent users")
demo.launch(
server_name="0.0.0.0",
server_port=7860,
show_api=False,
show_error=True
)
else:
demo.launch(share=True, debug=True)