Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -346,7 +346,6 @@ def run_analysis_free(text: str, topk: int, sector_filter: str):
|
|
| 346 |
"",
|
| 347 |
"",
|
| 348 |
pd.DataFrame(),
|
| 349 |
-
pd.DataFrame()
|
| 350 |
)
|
| 351 |
|
| 352 |
|
|
@@ -390,7 +389,7 @@ def run_analysis_free(text: str, topk: int, sector_filter: str):
|
|
| 390 |
if "similarity" in table.columns:
|
| 391 |
table["similarity"] = table["similarity"].astype(float).map(lambda x: f"{x:.3f}")
|
| 392 |
|
| 393 |
-
return kpi, plot_df, query, f"{voted} ({conf*100:.0f}%)", table
|
| 394 |
|
| 395 |
|
| 396 |
def run_analysis_struct(growth: str, margin: str, competition: str, leverage: str, sector: str, extra: str, topk: int):
|
|
@@ -459,14 +458,13 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft(primary_hue="blue", neutral_hue="sl
|
|
| 459 |
with gr.Tabs():
|
| 460 |
with gr.Tab("Free text"):
|
| 461 |
free_text = gr.Textbox(
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
)
|
| 468 |
|
| 469 |
-
|
| 470 |
with gr.Row():
|
| 471 |
sector_filter = gr.Dropdown(label="Sector (optional filter)", choices=sector_choices, value="Any")
|
| 472 |
topk = gr.Slider(label="Top-K", minimum=5, maximum=30, step=1, value=12)
|
|
@@ -476,15 +474,15 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft(primary_hue="blue", neutral_hue="sl
|
|
| 476 |
clear_btn = gr.Button("Clear", elem_id="clear_btn")
|
| 477 |
|
| 478 |
kpi_out = gr.HTML(value=kpi_html("β", "N/A", "N/A", "β"))
|
| 479 |
-
chart = gr.LinePlot(
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
)
|
| 486 |
-
query_out = gr.Textbox(label="IO PIPELINE (Query Text)", interactive=False)
|
| 487 |
-
rec_out = gr.Textbox(label="Voted Recommendation", interactive=False)
|
| 488 |
|
| 489 |
fit_out = gr.Textbox(
|
| 490 |
label="Fit Verdict",
|
|
|
|
| 346 |
"",
|
| 347 |
"",
|
| 348 |
pd.DataFrame(),
|
|
|
|
| 349 |
)
|
| 350 |
|
| 351 |
|
|
|
|
| 389 |
if "similarity" in table.columns:
|
| 390 |
table["similarity"] = table["similarity"].astype(float).map(lambda x: f"{x:.3f}")
|
| 391 |
|
| 392 |
+
return kpi, plot_df, query, f"{voted} ({conf*100:.0f}%)", "", pd.DataFrame(), table
|
| 393 |
|
| 394 |
|
| 395 |
def run_analysis_struct(growth: str, margin: str, competition: str, leverage: str, sector: str, extra: str, topk: int):
|
|
|
|
| 458 |
with gr.Tabs():
|
| 459 |
with gr.Tab("Free text"):
|
| 460 |
free_text = gr.Textbox(
|
| 461 |
+
label="Analyst note / company description",
|
| 462 |
+
placeholder="Type a company name or a short analyst noteβ¦",
|
| 463 |
+
lines=2,
|
| 464 |
+
max_lines=3,
|
| 465 |
+
elem_id="query_box",
|
| 466 |
)
|
| 467 |
|
|
|
|
| 468 |
with gr.Row():
|
| 469 |
sector_filter = gr.Dropdown(label="Sector (optional filter)", choices=sector_choices, value="Any")
|
| 470 |
topk = gr.Slider(label="Top-K", minimum=5, maximum=30, step=1, value=12)
|
|
|
|
| 474 |
clear_btn = gr.Button("Clear", elem_id="clear_btn")
|
| 475 |
|
| 476 |
kpi_out = gr.HTML(value=kpi_html("β", "N/A", "N/A", "β"))
|
| 477 |
+
chart = gr.LinePlot(
|
| 478 |
+
x="rank",
|
| 479 |
+
y="similarity",
|
| 480 |
+
title="Top-K Similarity Scores",
|
| 481 |
+
tooltip=["rank", "similarity"],
|
| 482 |
+
height=280
|
| 483 |
)
|
| 484 |
+
query_out = gr.Textbox(label="IO PIPELINE (Query Text)", interactive=False)
|
| 485 |
+
rec_out = gr.Textbox(label="Voted Recommendation", interactive=False)
|
| 486 |
|
| 487 |
fit_out = gr.Textbox(
|
| 488 |
label="Fit Verdict",
|