Smart-Trader-EA commited on
Commit
dab597a
Β·
1 Parent(s): 19848e6

Fix Gradio compatibility issue

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -170,8 +170,23 @@ def load_available_data():
170
  """Load and preprocess all available data files"""
171
  available_data = {}
172
 
 
173
  if not os.path.exists(RAW_DATA_DIR):
174
  print(f"⚠️ Raw data directory not found: {RAW_DATA_DIR}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  return available_data
176
 
177
  print(f"πŸ” Scanning for data files in {RAW_DATA_DIR}...")
@@ -448,8 +463,8 @@ def analyze_trading_pair(pair_name):
448
  traceback.print_exc()
449
  return error_msg, None, None
450
 
451
- # Create Gradio interface
452
- with gr.Blocks(title="Trading Pair AI Analyzer", theme=gr.themes.Soft()) as demo:
453
  gr.Markdown("# πŸ“ˆ Trading Pair AI Analysis System")
454
  gr.Markdown("### Analyze forex, stocks, and crypto with AI-powered insights")
455
 
 
170
  """Load and preprocess all available data files"""
171
  available_data = {}
172
 
173
+ # Check if raw data directory exists
174
  if not os.path.exists(RAW_DATA_DIR):
175
  print(f"⚠️ Raw data directory not found: {RAW_DATA_DIR}")
176
+ # Check if data is in root directory instead
177
+ if os.path.exists("data") and os.path.isdir("data"):
178
+ for filename in os.listdir("data"):
179
+ if filename.endswith('.csv'):
180
+ # Create raw directory structure
181
+ os.makedirs(RAW_DATA_DIR, exist_ok=True)
182
+ # Move file to raw directory
183
+ import shutil
184
+ shutil.move(os.path.join("data", filename), os.path.join(RAW_DATA_DIR, filename))
185
+ print(f"βœ… Moved {filename} to {RAW_DATA_DIR}")
186
+
187
+ # Check again after potential move
188
+ if not os.path.exists(RAW_DATA_DIR):
189
+ print(f"❌ Still cannot find raw data directory: {RAW_DATA_DIR}")
190
  return available_data
191
 
192
  print(f"πŸ” Scanning for data files in {RAW_DATA_DIR}...")
 
463
  traceback.print_exc()
464
  return error_msg, None, None
465
 
466
+ # Create Gradio interface - FIXED: Removed theme parameter for compatibility
467
+ with gr.Blocks(title="Trading Pair AI Analyzer") as demo:
468
  gr.Markdown("# πŸ“ˆ Trading Pair AI Analysis System")
469
  gr.Markdown("### Analyze forex, stocks, and crypto with AI-powered insights")
470