Spaces:
Sleeping
Sleeping
| """ | |
| Hugging Face Spaces entry point for Financial Research Agent | |
| """ | |
| import os | |
| import sys | |
| import logging | |
| # Setup Python path | |
| sys.path.insert(0, os.path.dirname(__file__)) | |
| # Configure logging for Hugging Face | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", | |
| ) | |
| logger = logging.getLogger(__name__) | |
| # Import after path setup | |
| from src.api.server import AnalysisServer | |
| def main(): | |
| """Launch the Gradio interface for Hugging Face Spaces""" | |
| try: | |
| logger.info("Starting Financial Research Agent on Hugging Face Spaces...") | |
| # Create and launch server | |
| server = AnalysisServer() | |
| # Launch with Hugging Face Spaces settings | |
| interface = server.create_interface() | |
| # Hugging Face Spaces specific configuration | |
| interface.launch( | |
| server_name="0.0.0.0", | |
| server_port=7860, # HF Spaces default port | |
| share=False, # No need for share on HF Spaces | |
| show_error=True, | |
| auth=None, # Can add auth later if needed | |
| ) | |
| except Exception as e: | |
| logger.error(f"Failed to start application: {str(e)}") | |
| raise | |
| if __name__ == "__main__": | |
| main() | |