Spaces:
Sleeping
Sleeping
QAway-to
commited on
Commit
·
08efbfa
1
Parent(s):
f6d1946
New tabs and functions v2.4
Browse files- app.py +24 -13
- core/ui_style.css +59 -15
app.py
CHANGED
|
@@ -70,28 +70,39 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 70 |
chart_out = gr.Plot(label="Alpha vs BTC")
|
| 71 |
chart_btn.click(fn=build_alpha_chart, inputs=chart_in, outputs=chart_out)
|
| 72 |
|
| 73 |
-
# --- Crypto Intelligence Dashboard (
|
| 74 |
with gr.TabItem("Crypto Intelligence Dashboard"):
|
| 75 |
gr.Markdown("### 💹 Coinlore Market Dashboard (Altair Edition)")
|
| 76 |
|
|
|
|
| 77 |
with gr.Row():
|
| 78 |
-
top_slider = gr.Slider(
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
with gr.Row():
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
ai_box = gr.Textbox(label="AI Market Summary", lines=8, elem_id="llm_comment_box")
|
| 89 |
|
| 90 |
def run_dash(n): return build_crypto_dashboard(n)
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
gr.Markdown("---")
|
| 97 |
gr.Markdown(
|
|
|
|
| 70 |
chart_out = gr.Plot(label="Alpha vs BTC")
|
| 71 |
chart_btn.click(fn=build_alpha_chart, inputs=chart_in, outputs=chart_out)
|
| 72 |
|
| 73 |
+
# --- Crypto Intelligence Dashboard (Refined layout) ---
|
| 74 |
with gr.TabItem("Crypto Intelligence Dashboard"):
|
| 75 |
gr.Markdown("### 💹 Coinlore Market Dashboard (Altair Edition)")
|
| 76 |
|
| 77 |
+
# Controls
|
| 78 |
with gr.Row():
|
| 79 |
+
top_slider = gr.Slider(
|
| 80 |
+
label="Top N coins", minimum=20, maximum=100, step=10, value=50, scale=70
|
| 81 |
+
)
|
| 82 |
+
load_btn = gr.Button("Generate Dashboard", variant="primary", scale=30)
|
| 83 |
|
| 84 |
+
# Main layout
|
| 85 |
+
with gr.Row(equal_height=True):
|
| 86 |
+
with gr.Column(scale=70):
|
| 87 |
+
treemap_plot = gr.Plot(label="Market Composition")
|
| 88 |
+
with gr.Column(scale=30):
|
| 89 |
+
ai_box = gr.Textbox(label="AI Market Summary", lines=18, elem_id="ai_summary_sidebar")
|
| 90 |
|
| 91 |
+
with gr.Row(equal_height=True):
|
| 92 |
+
movers_plot = gr.Plot(label="Top Movers", scale=50)
|
| 93 |
+
scatter_plot = gr.Plot(label="Market Cap vs Volume", scale=50)
|
| 94 |
+
|
| 95 |
+
from core.crypto_dashboard import build_crypto_dashboard
|
| 96 |
|
|
|
|
| 97 |
|
| 98 |
def run_dash(n): return build_crypto_dashboard(n)
|
| 99 |
+
|
| 100 |
+
load_btn.click(
|
| 101 |
+
fn=run_dash,
|
| 102 |
+
inputs=top_slider,
|
| 103 |
+
outputs=[treemap_plot, movers_plot, scatter_plot, ai_box],
|
| 104 |
+
show_progress="minimal",
|
| 105 |
+
)
|
| 106 |
|
| 107 |
gr.Markdown("---")
|
| 108 |
gr.Markdown(
|
core/ui_style.css
CHANGED
|
@@ -26,36 +26,80 @@ h2, h3, .gr-markdown {
|
|
| 26 |
/* === Plot Sizing and Spacing === */
|
| 27 |
[data-testid="plot-container"] {
|
| 28 |
width: 100% !important;
|
| 29 |
-
margin: 0 auto
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
[data-testid="plot-container"] canvas {
|
| 32 |
width: 100% !important;
|
| 33 |
height: auto !important;
|
| 34 |
}
|
| 35 |
|
| 36 |
-
/* ===
|
| 37 |
-
.gr-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
}
|
| 43 |
-
.gr-slider input[type=range]::-webkit-slider-thumb {
|
| 44 |
-
background: #6366f1 !important;
|
| 45 |
}
|
| 46 |
|
| 47 |
-
/*
|
| 48 |
-
[
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
/* ===
|
|
|
|
| 52 |
#llm_comment_box textarea {
|
|
|
|
| 53 |
background-color: #161b22 !important;
|
| 54 |
color: #f0f6fc !important;
|
| 55 |
border: 1px solid #30363d !important;
|
| 56 |
border-radius: 6px !important;
|
| 57 |
font-family: 'JetBrains Mono', monospace !important;
|
| 58 |
-
font-size:
|
| 59 |
line-height: 1.5 !important;
|
| 60 |
padding: 12px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
}
|
|
|
|
| 26 |
/* === Plot Sizing and Spacing === */
|
| 27 |
[data-testid="plot-container"] {
|
| 28 |
width: 100% !important;
|
| 29 |
+
margin: 0 auto 22px auto !important;
|
| 30 |
+
background: transparent !important;
|
| 31 |
+
border: none !important;
|
| 32 |
}
|
| 33 |
[data-testid="plot-container"] canvas {
|
| 34 |
width: 100% !important;
|
| 35 |
height: auto !important;
|
| 36 |
}
|
| 37 |
|
| 38 |
+
/* === Dashboard Layout === */
|
| 39 |
+
.gr-row { gap: 18px !important; }
|
| 40 |
+
|
| 41 |
+
/* Верхний график (Treemap) */
|
| 42 |
+
#root [label="Market Composition"] canvas {
|
| 43 |
+
height: 360px !important;
|
|
|
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
|
| 46 |
+
/* Нижние графики (Movers + Scatter) */
|
| 47 |
+
#root [label="Top Movers"] canvas,
|
| 48 |
+
#root [label="Market Cap vs Volume"] canvas {
|
| 49 |
+
height: 320px !important;
|
| 50 |
+
}
|
| 51 |
|
| 52 |
+
/* === Sidebar (AI Summary) === */
|
| 53 |
+
#ai_summary_sidebar textarea,
|
| 54 |
#llm_comment_box textarea {
|
| 55 |
+
height: 360px !important;
|
| 56 |
background-color: #161b22 !important;
|
| 57 |
color: #f0f6fc !important;
|
| 58 |
border: 1px solid #30363d !important;
|
| 59 |
border-radius: 6px !important;
|
| 60 |
font-family: 'JetBrains Mono', monospace !important;
|
| 61 |
+
font-size: 13.5px !important;
|
| 62 |
line-height: 1.5 !important;
|
| 63 |
padding: 12px !important;
|
| 64 |
+
resize: none !important;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/* === Sliders, Buttons, Text === */
|
| 68 |
+
.gr-button {
|
| 69 |
+
border-radius: 6px !important;
|
| 70 |
+
font-weight: 600 !important;
|
| 71 |
+
letter-spacing: 0.3px;
|
| 72 |
+
height: 52px !important;
|
| 73 |
+
background: linear-gradient(90deg, #4f46e5, #6366f1) !important;
|
| 74 |
+
border: none !important;
|
| 75 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
| 76 |
+
transition: all 0.2s ease-in-out;
|
| 77 |
+
}
|
| 78 |
+
.gr-button:hover {
|
| 79 |
+
filter: brightness(1.08);
|
| 80 |
+
transform: translateY(-1px);
|
| 81 |
+
}
|
| 82 |
+
.gr-slider {
|
| 83 |
+
height: 52px !important;
|
| 84 |
+
}
|
| 85 |
+
.gr-slider input[type=range]::-webkit-slider-thumb {
|
| 86 |
+
background: #6366f1 !important;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/* === Tables === */
|
| 90 |
+
.gr-dataframe table {
|
| 91 |
+
width: 100% !important;
|
| 92 |
+
color: #c9d1d9 !important;
|
| 93 |
+
background: #161b22 !important;
|
| 94 |
+
}
|
| 95 |
+
.gr-dataframe th {
|
| 96 |
+
background-color: #21262d !important;
|
| 97 |
+
color: #f0f6fc !important;
|
| 98 |
+
border-bottom: 1px solid #30363d !important;
|
| 99 |
+
text-transform: uppercase;
|
| 100 |
+
font-weight: 600 !important;
|
| 101 |
+
}
|
| 102 |
+
.gr-dataframe td {
|
| 103 |
+
border-top: 1px solid #30363d !important;
|
| 104 |
+
padding: 8px !important;
|
| 105 |
}
|