Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
# app.py (V25.
|
| 2 |
-
# تم إ
|
| 3 |
|
| 4 |
import os
|
| 5 |
import sys
|
|
@@ -37,7 +37,7 @@ try:
|
|
| 37 |
from r2 import R2Service
|
| 38 |
from ml_engine.data_manager import DataManager
|
| 39 |
from whale_monitor.core import EnhancedWhaleMonitor
|
| 40 |
-
from whale_monitor.rpc_manager import AdaptiveRpcManager
|
| 41 |
from sentiment_news import NewsFetcher
|
| 42 |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
| 43 |
from ml_engine.processor import MLProcessor
|
|
@@ -155,7 +155,7 @@ async def auto_pilot_loop():
|
|
| 155 |
@asynccontextmanager
|
| 156 |
async def lifespan(app: FastAPI):
|
| 157 |
global r2, data_manager, ml_processor, hub_manager, trade_manager, whale_monitor, news_fetcher, senti_analyzer, sys_state
|
| 158 |
-
logger.info("\n🚀 [System] Startup Sequence Initiated (Titan V25.
|
| 159 |
try:
|
| 160 |
logger.info(" [1/7] Initializing R2 & Data Services...")
|
| 161 |
r2 = R2Service()
|
|
@@ -536,17 +536,17 @@ async def check_live_pnl_and_status(selected_view="Hybrid System"):
|
|
| 536 |
return "Error", "Error", empty_chart, "0", "0", "0", "0", "0%", wl_df_empty, "Err", "Err", "Err"
|
| 537 |
|
| 538 |
# ==============================================================================
|
| 539 |
-
# 🎨 Gradio UI (
|
| 540 |
# ==============================================================================
|
| 541 |
def create_gradio_ui():
|
| 542 |
-
# [FIX] نستخدم الحقن المباشر داخل البلوك بدلاً من تمرير css في الـ constructor
|
| 543 |
custom_css = ".gradio-container {background:#0b0f19} .dataframe {background:#1a1a1a!important} .html-box {min-height:180px}"
|
| 544 |
|
| 545 |
-
|
|
|
|
| 546 |
# حقن الـ CSS هنا
|
| 547 |
gr.HTML(f"<style>{custom_css}</style>")
|
| 548 |
|
| 549 |
-
gr.Markdown("# 🚀 Titan V25.
|
| 550 |
|
| 551 |
with gr.Row():
|
| 552 |
with gr.Column(scale=3):
|
|
@@ -595,7 +595,7 @@ def create_gradio_ui():
|
|
| 595 |
# ==============================================================================
|
| 596 |
# 🏁 Server
|
| 597 |
# ==============================================================================
|
| 598 |
-
fast_api_server = FastAPI(lifespan=lifespan, title="Titan V25.
|
| 599 |
gradio_dashboard = create_gradio_ui()
|
| 600 |
app = gr.mount_gradio_app(app=fast_api_server, blocks=gradio_dashboard, path="/")
|
| 601 |
|
|
|
|
| 1 |
+
# app.py (V25.2 - GEM-Architect: Bulletproof Gradio UI)
|
| 2 |
+
# تم إزالة جميع معاملات التنسيق (theme, css) من Constructor لضمان العمل على أي إصدار.
|
| 3 |
|
| 4 |
import os
|
| 5 |
import sys
|
|
|
|
| 37 |
from r2 import R2Service
|
| 38 |
from ml_engine.data_manager import DataManager
|
| 39 |
from whale_monitor.core import EnhancedWhaleMonitor
|
| 40 |
+
from whale_monitor.rpc_manager import AdaptiveRpcManager
|
| 41 |
from sentiment_news import NewsFetcher
|
| 42 |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
| 43 |
from ml_engine.processor import MLProcessor
|
|
|
|
| 155 |
@asynccontextmanager
|
| 156 |
async def lifespan(app: FastAPI):
|
| 157 |
global r2, data_manager, ml_processor, hub_manager, trade_manager, whale_monitor, news_fetcher, senti_analyzer, sys_state
|
| 158 |
+
logger.info("\n🚀 [System] Startup Sequence Initiated (Titan V25.2)...")
|
| 159 |
try:
|
| 160 |
logger.info(" [1/7] Initializing R2 & Data Services...")
|
| 161 |
r2 = R2Service()
|
|
|
|
| 536 |
return "Error", "Error", empty_chart, "0", "0", "0", "0", "0%", wl_df_empty, "Err", "Err", "Err"
|
| 537 |
|
| 538 |
# ==============================================================================
|
| 539 |
+
# 🎨 Gradio UI (Bulletproof Style Injection)
|
| 540 |
# ==============================================================================
|
| 541 |
def create_gradio_ui():
|
|
|
|
| 542 |
custom_css = ".gradio-container {background:#0b0f19} .dataframe {background:#1a1a1a!important} .html-box {min-height:180px}"
|
| 543 |
|
| 544 |
+
# [CRITICAL FIX] إزالة جميع المعاملات الاختيارية من Blocks()
|
| 545 |
+
with gr.Blocks(title="Titan V25.2") as demo:
|
| 546 |
# حقن الـ CSS هنا
|
| 547 |
gr.HTML(f"<style>{custom_css}</style>")
|
| 548 |
|
| 549 |
+
gr.Markdown("# 🚀 Titan V25.2 (Full Architecture - Web3 Enabled)")
|
| 550 |
|
| 551 |
with gr.Row():
|
| 552 |
with gr.Column(scale=3):
|
|
|
|
| 595 |
# ==============================================================================
|
| 596 |
# 🏁 Server
|
| 597 |
# ==============================================================================
|
| 598 |
+
fast_api_server = FastAPI(lifespan=lifespan, title="Titan V25.2 Pro", description="Titan Enterprise Trading System")
|
| 599 |
gradio_dashboard = create_gradio_ui()
|
| 600 |
app = gr.mount_gradio_app(app=fast_api_server, blocks=gradio_dashboard, path="/")
|
| 601 |
|