""" NSE F&O Analyzer Application """ import gradio as gr import logging import traceback import os import sys # Add nse_modules to path sys.path.append(os.path.join(os.path.dirname(__file__), 'nse_modules')) # Configure logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) class NSEAnalyzerApp: def __init__(self): print("🟡 Starting NSE Analyzer App init...") try: # Import NSE modules print("🟡 Importing NSE modules...") from nse_modules.single_day_download import SingleDayDownload from nse_modules.batch_download import BatchDownload from nse_modules.data_summary import DataSummary from nse_modules.ai_analysis import AIAnalysis, run_ai_analysis # Initialize NSE modules self.single_day_download = SingleDayDownload() self.batch_download = BatchDownload() self.data_summary = DataSummary() self.AIAnalysis = AIAnalysis # Store class reference self.run_ai_analysis = run_ai_analysis # Store function reference print("🟡 Creating interface...") self.interface = self.create_interface() print("🟢 Interface created successfully") # In your NSEAnalyzerApp.__init__() method, add: import os print(f"📁 Current working directory: {os.getcwd()}") print(f"📁 Contents of current directory: {os.listdir('.')}") print(f"📁 /data directory exists: {os.path.exists('/data')}") if os.path.exists('/data'): print(f"📁 Contents of /data: {os.listdir('/data')}") except Exception as e: print(f"🔴 Error during initialization: {e}") print(f"🔴 Traceback: {traceback.format_exc()}") self.interface = self.create_fallback_interface() def create_fallback_interface(self): """Create fallback interface""" with gr.Blocks(title="NSE Analyzer - Fallback") as interface: gr.Markdown("# ⚠️ NSE F&O Analyzer - Fallback Mode") gr.Markdown("There was an error initializing the application. Please check the logs.") return interface def create_interface(self): """Create main Gradio interface""" with gr.Blocks( title="Divya Shah - AI Strategies for Option Sellers", theme=gr.themes.Soft(), css=""" .gradio-container {max-width: 1200px !important} .brand-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 25px; border-radius: 15px; color: white; text-align: center; margin-bottom: 20px; } """ ) as interface: # Your branded header gr.Markdown("""
Professional Options Trading Analysis Platform