Spaces:
Sleeping
Sleeping
Smart-Trader-EA commited on
Commit Β·
dab597a
1
Parent(s): 19848e6
Fix Gradio compatibility issue
Browse files
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"
|
| 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 |
|