Spaces:
Running
Running
| #!/usr/bin/env python3 | |
| """ | |
| Simple script to run the sentiment analysis server | |
| """ | |
| import uvicorn | |
| import sys | |
| import os | |
| def main(): | |
| """Run the FastAPI server""" | |
| print("Starting Sentiment Analysis API Server...") | |
| print("Server will be available at: http://localhost:8000") | |
| print("API Documentation: http://localhost:8000/docs") | |
| print("Health Check: http://localhost:8000/health") | |
| print("\nPress Ctrl+C to stop the server\n") | |
| try: | |
| uvicorn.run( | |
| "main:app", | |
| host="0.0.0.0", | |
| port=8000, | |
| reload=True, | |
| log_level="info" | |
| ) | |
| except KeyboardInterrupt: | |
| print("\nServer stopped!") | |
| except Exception as e: | |
| print(f"Error starting server: {e}") | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| main() | |