Spaces:
Sleeping
Sleeping
File size: 2,043 Bytes
417c5c4 daebdfa 417c5c4 2554650 417c5c4 2554650 417c5c4 2554650 081c109 2554650 081c109 2554650 eb14570 2554650 417c5c4 daebdfa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
#!/usr/bin/env python3
"""
Medical AI Assistant - Startup Script
Simple script to start the medical chatbot system
Not needed for huggingface deployment
"""
import os
import sys
import uvicorn
def main():
"""Start the Medical AI Assistant"""
print("π Medical AI Assistant")
print("=" * 50)
# Check if we're in the right directory
if not os.path.exists("app.py"):
print("β Error: app.py not found!")
print("Please run this script from the MedicalDiagnosisSystem directory.")
sys.exit(1)
# Check for environment variables
gemini_keys = []
for i in range(1, 6):
key = os.getenv(f"GEMINI_API_{i}")
if key:
gemini_keys.append(f"GEMINI_API_{i}")
if not gemini_keys:
print("β οΈ Warning: No Gemini API keys found!")
print("Set GEMINI_API_1, GEMINI_API_2, etc. environment variables for full functionality.")
print("The system will work with mock responses for demo purposes.")
else:
print(f"β
Found {len(gemini_keys)} Gemini API keys")
# Check for MongoDB environment variables
mongo_user = os.getenv("MONGO_USER")
user_db = os.getenv("USER_DB")
if not mongo_user:
print("β Error: MONGO_USER environment variable not found!")
print("Set MONGO_USER environment variable for database connectivity.")
sys.exit(1)
if not user_db:
print("β Error: USER_DB environment variable not found!")
print("Set USER_DB environment variable for database connectivity.")
sys.exit(1)
print("β
MongoDB environment variables found")
print("\nπ± Starting Medical AI Assistant...")
print("π Web UI will be available at: https://medai-cos30018-medicaldiagnosissystem.hf.space")
print("π API documentation at: https://medai-cos30018-medicaldiagnosissystem.hf.space/docs")
print("π Health check at: https://medai-cos30018-medicaldiagnosissystem.hf.space/health")
print("\nPress Ctrl+C to stop the server")
print("=" * 50)
# Start the server
uvicorn.run(
"src.main:app",
host="0.0.0.0",
port=7860,
log_level="info",
reload=True
)
if __name__ == "__main__":
main()
|