Spaces:
Sleeping
Sleeping
| # Import all components from both files | |
| from general_rag import app, models, data | |
| from medical_rag import * | |
| from fastapi import FastAPI | |
| import uvicorn | |
| from general_rag import load_models | |
| from medical_rag import load_medical_models | |
| # Initialize all components | |
| def initialize_app(): | |
| # Load general models and data | |
| general_success = load_models() and load_data() | |
| # Load medical-specific models | |
| medical_success = load_medical_models() | |
| return general_success and medical_success | |
| async def root(): | |
| return {"message": "Welcome to TeaRAG! Your Medical Assistant Powered by RAG"} | |
| async def health_check(): | |
| """Health check endpoint""" | |
| status = { | |
| 'status': 'healthy', | |
| 'models_loaded': bool(models), | |
| 'embeddings_loaded': bool(data.get('embeddings')), | |
| 'documents_loaded': not data.get('df', pd.DataFrame()).empty | |
| } | |
| return status | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(app, host="0.0.0.0", port=7860) |