Spaces:
Sleeping
Sleeping
QAway-to
commited on
Commit
·
f3b6ce8
1
Parent(s):
14571ce
Back to old version v1.1
Browse files
app.py
CHANGED
|
@@ -18,11 +18,11 @@ dark_theme = gr.themes.Base(
|
|
| 18 |
secondary_hue="gray",
|
| 19 |
neutral_hue="zinc",
|
| 20 |
).set(
|
| 21 |
-
body_background_fill="#0d1117",
|
| 22 |
-
body_text_color="#e6edf3",
|
| 23 |
-
block_background_fill="#161b22",
|
| 24 |
-
block_border_color="#30363d",
|
| 25 |
-
button_primary_background_fill="#4f46e5"
|
| 26 |
button_primary_background_fill_hover="#6366f1",
|
| 27 |
button_primary_text_color="#ffffff",
|
| 28 |
input_background_fill="#0d1117",
|
|
@@ -34,15 +34,16 @@ dark_theme = gr.themes.Base(
|
|
| 34 |
with gr.Blocks(theme=dark_theme, css="""
|
| 35 |
/* === Bloomberg / Dark Finance Style === */
|
| 36 |
.gradio-container {
|
| 37 |
-
max-width:
|
| 38 |
margin: auto !important;
|
| 39 |
font-family: 'Inter', sans-serif;
|
| 40 |
background-color: #0d1117 !important;
|
| 41 |
}
|
|
|
|
| 42 |
/* === LLM Commentary Styling === */
|
| 43 |
#llm_comment_box textarea {
|
| 44 |
-
max-height:
|
| 45 |
-
overflow-y: auto !important;
|
| 46 |
background-color: #161b22 !important;
|
| 47 |
color: #f0f6fc !important;
|
| 48 |
border: 1px solid #30363d !important;
|
|
@@ -52,11 +53,13 @@ with gr.Blocks(theme=dark_theme, css="""
|
|
| 52 |
line-height: 1.5 !important;
|
| 53 |
padding: 12px !important;
|
| 54 |
}
|
| 55 |
-
|
|
|
|
| 56 |
#comparison_table {
|
| 57 |
margin-top: 8px !important;
|
| 58 |
}
|
| 59 |
-
|
|
|
|
| 60 |
h2, h3, .gr-markdown {
|
| 61 |
font-weight: 600;
|
| 62 |
color: #f0f6fc !important;
|
|
@@ -84,6 +87,7 @@ h2, h3, .gr-markdown {
|
|
| 84 |
.gr-plot {
|
| 85 |
background: #0d1117 !important;
|
| 86 |
}
|
|
|
|
| 87 |
/* Fix Gradio plot overlay */
|
| 88 |
#alpha_chart svg {
|
| 89 |
display: none !important;
|
|
@@ -92,6 +96,7 @@ h2, h3, .gr-markdown {
|
|
| 92 |
background: transparent !important;
|
| 93 |
box-shadow: none !important;
|
| 94 |
}
|
|
|
|
| 95 |
/* === Styled comparison table === */
|
| 96 |
.gr-dataframe table {
|
| 97 |
border-collapse: collapse !important;
|
|
@@ -110,7 +115,6 @@ h2, h3, .gr-markdown {
|
|
| 110 |
border-top: 1px solid #30363d !important;
|
| 111 |
padding: 8px !important;
|
| 112 |
}
|
| 113 |
-
|
| 114 |
""") as demo:
|
| 115 |
gr.Markdown("## Investment Portfolio Analyzer")
|
| 116 |
gr.Markdown(
|
|
@@ -137,11 +141,11 @@ h2, h3, .gr-markdown {
|
|
| 137 |
comp_input_2 = gr.Textbox(label="Portfolio B", value="b1ef37aa-5b9a-41b4-9394-8823f2de36bb")
|
| 138 |
comp_button = gr.Button("Load Comparison", variant="primary")
|
| 139 |
|
| 140 |
-
#
|
| 141 |
comp_output_comment = gr.Textbox(
|
| 142 |
label="AI Commentary",
|
| 143 |
-
lines=
|
| 144 |
-
interactive=
|
| 145 |
show_copy_button=True,
|
| 146 |
elem_id="llm_comment_box",
|
| 147 |
)
|
|
@@ -150,10 +154,10 @@ h2, h3, .gr-markdown {
|
|
| 150 |
label="Comparative Metrics",
|
| 151 |
wrap=True,
|
| 152 |
elem_id="comparison_table",
|
|
|
|
| 153 |
)
|
| 154 |
|
| 155 |
from core.comparison_table import show_comparison_table
|
| 156 |
-
|
| 157 |
comp_button.click(
|
| 158 |
fn=show_comparison_table,
|
| 159 |
inputs=[comp_input_1, comp_input_2],
|
|
|
|
| 18 |
secondary_hue="gray",
|
| 19 |
neutral_hue="zinc",
|
| 20 |
).set(
|
| 21 |
+
body_background_fill="#0d1117",
|
| 22 |
+
body_text_color="#e6edf3",
|
| 23 |
+
block_background_fill="#161b22",
|
| 24 |
+
block_border_color="#30363d",
|
| 25 |
+
button_primary_background_fill="#4f46e5",
|
| 26 |
button_primary_background_fill_hover="#6366f1",
|
| 27 |
button_primary_text_color="#ffffff",
|
| 28 |
input_background_fill="#0d1117",
|
|
|
|
| 34 |
with gr.Blocks(theme=dark_theme, css="""
|
| 35 |
/* === Bloomberg / Dark Finance Style === */
|
| 36 |
.gradio-container {
|
| 37 |
+
max-width: 1100px !important; /* unified width (Analysis + ~100px) */
|
| 38 |
margin: auto !important;
|
| 39 |
font-family: 'Inter', sans-serif;
|
| 40 |
background-color: #0d1117 !important;
|
| 41 |
}
|
| 42 |
+
|
| 43 |
/* === LLM Commentary Styling === */
|
| 44 |
#llm_comment_box textarea {
|
| 45 |
+
max-height: 600px !important; /* taller commentary block */
|
| 46 |
+
overflow-y: auto !important;
|
| 47 |
background-color: #161b22 !important;
|
| 48 |
color: #f0f6fc !important;
|
| 49 |
border: 1px solid #30363d !important;
|
|
|
|
| 53 |
line-height: 1.5 !important;
|
| 54 |
padding: 12px !important;
|
| 55 |
}
|
| 56 |
+
|
| 57 |
+
/* Comparison table directly below commentary */
|
| 58 |
#comparison_table {
|
| 59 |
margin-top: 8px !important;
|
| 60 |
}
|
| 61 |
+
|
| 62 |
+
/* Typography & Buttons */
|
| 63 |
h2, h3, .gr-markdown {
|
| 64 |
font-weight: 600;
|
| 65 |
color: #f0f6fc !important;
|
|
|
|
| 87 |
.gr-plot {
|
| 88 |
background: #0d1117 !important;
|
| 89 |
}
|
| 90 |
+
|
| 91 |
/* Fix Gradio plot overlay */
|
| 92 |
#alpha_chart svg {
|
| 93 |
display: none !important;
|
|
|
|
| 96 |
background: transparent !important;
|
| 97 |
box-shadow: none !important;
|
| 98 |
}
|
| 99 |
+
|
| 100 |
/* === Styled comparison table === */
|
| 101 |
.gr-dataframe table {
|
| 102 |
border-collapse: collapse !important;
|
|
|
|
| 115 |
border-top: 1px solid #30363d !important;
|
| 116 |
padding: 8px !important;
|
| 117 |
}
|
|
|
|
| 118 |
""") as demo:
|
| 119 |
gr.Markdown("## Investment Portfolio Analyzer")
|
| 120 |
gr.Markdown(
|
|
|
|
| 141 |
comp_input_2 = gr.Textbox(label="Portfolio B", value="b1ef37aa-5b9a-41b4-9394-8823f2de36bb")
|
| 142 |
comp_button = gr.Button("Load Comparison", variant="primary")
|
| 143 |
|
| 144 |
+
# LLM commentary ABOVE the table
|
| 145 |
comp_output_comment = gr.Textbox(
|
| 146 |
label="AI Commentary",
|
| 147 |
+
lines=14, # visually balanced with table height
|
| 148 |
+
interactive=False,
|
| 149 |
show_copy_button=True,
|
| 150 |
elem_id="llm_comment_box",
|
| 151 |
)
|
|
|
|
| 154 |
label="Comparative Metrics",
|
| 155 |
wrap=True,
|
| 156 |
elem_id="comparison_table",
|
| 157 |
+
height=700, # keeps proportions consistent
|
| 158 |
)
|
| 159 |
|
| 160 |
from core.comparison_table import show_comparison_table
|
|
|
|
| 161 |
comp_button.click(
|
| 162 |
fn=show_comparison_table,
|
| 163 |
inputs=[comp_input_1, comp_input_2],
|