Update src/streamlit_app.py
Browse files- src/streamlit_app.py +147 -142
src/streamlit_app.py
CHANGED
|
@@ -408,160 +408,165 @@ def create_summary_table(df):
|
|
| 408 |
|
| 409 |
return df_summary
|
| 410 |
|
| 411 |
-
|
| 412 |
-
st.markdown("""
|
| 413 |
-
<div class="header-container">
|
| 414 |
-
<h1>NaviTrace Leaderboard</h1>
|
| 415 |
-
<div class="links-container">
|
| 416 |
-
<a href="https://leggedrobotics.github.io/navitrace_webpage/">
|
| 417 |
-
๐ Project
|
| 418 |
-
</a>
|
| 419 |
-
<a href="https://arxiv.org/abs/2510.26909">
|
| 420 |
-
๐ Paper
|
| 421 |
-
</a>
|
| 422 |
-
<a href="https://github.com/leggedrobotics/navitrace_evaluation">
|
| 423 |
-
๐ป Code
|
| 424 |
-
</a>
|
| 425 |
-
<a href="https://huggingface.co/datasets/leggedrobotics/navitrace">
|
| 426 |
-
๐พ Dataset
|
| 427 |
-
</a>
|
| 428 |
-
</div>
|
| 429 |
-
</div>
|
| 430 |
-
""", unsafe_allow_html=True)
|
| 431 |
-
|
| 432 |
-
# Load data
|
| 433 |
-
df = load_data()
|
| 434 |
-
|
| 435 |
-
# Add user's model if it exists in session state
|
| 436 |
-
if 'user_results' in st.session_state:
|
| 437 |
-
user_results = pd.DataFrame(st.session_state.user_results)
|
| 438 |
-
df = pd.concat([user_results, df], ignore_index=True)
|
| 439 |
-
|
| 440 |
-
# View selector
|
| 441 |
-
view_type = st.selectbox(
|
| 442 |
-
"Select View",
|
| 443 |
-
["Total Score", "Per Embodiment", "Per Category"],
|
| 444 |
-
)
|
| 445 |
|
| 446 |
-
#
|
| 447 |
-
fig = create_bar_chart(df, view_type)
|
| 448 |
-
st.plotly_chart(fig, use_container_width=True, config={
|
| 449 |
-
'displayModeBar': True,
|
| 450 |
-
'displaylogo': False,
|
| 451 |
-
'toImageButtonOptions': {
|
| 452 |
-
'format': 'png',
|
| 453 |
-
'filename': 'navitrace_leaderboard',
|
| 454 |
-
'height': 600,
|
| 455 |
-
'width': 1200,
|
| 456 |
-
'scale': 2
|
| 457 |
-
}
|
| 458 |
-
})
|
| 459 |
-
|
| 460 |
-
# Detailed table
|
| 461 |
-
with st.expander("View Detailed Scores"):
|
| 462 |
-
# Create the summary table
|
| 463 |
-
df_summary = create_summary_table(df)
|
| 464 |
-
|
| 465 |
-
# Display table
|
| 466 |
-
st.dataframe(
|
| 467 |
-
df_summary.style.background_gradient(
|
| 468 |
-
cmap="Blues",
|
| 469 |
-
subset=[col for col in df_summary.columns if col != "model"]
|
| 470 |
-
).format("{:.2f}", subset=[col for col in df_summary.columns if col != "model"]),
|
| 471 |
-
width="stretch",
|
| 472 |
-
hide_index=True,
|
| 473 |
-
)
|
| 474 |
-
|
| 475 |
-
with st.expander("How to Test Your Model", expanded=True):
|
| 476 |
-
# Step 1
|
| 477 |
st.markdown("""
|
| 478 |
-
<div class="
|
| 479 |
-
<
|
| 480 |
-
<div class="
|
| 481 |
-
<
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
</div>
|
| 486 |
</div>
|
| 487 |
""", unsafe_allow_html=True)
|
| 488 |
|
| 489 |
-
|
|
|
|
| 490 |
|
| 491 |
-
#
|
| 492 |
-
st.markdown("""
|
| 493 |
-
<div class="instruction-item">
|
| 494 |
-
<div class="instruction-number">2</div>
|
| 495 |
-
<div class="instruction-content">
|
| 496 |
-
<div><b>Upload Results</b></div>
|
| 497 |
-
<div>
|
| 498 |
-
Upload the TSV file generated by the evaluation notebook.
|
| 499 |
-
</div>
|
| 500 |
-
</div>
|
| 501 |
-
</div>
|
| 502 |
-
""", unsafe_allow_html=True)
|
| 503 |
-
|
| 504 |
-
# Chunk uploaded file to circumvent HF limit
|
| 505 |
-
#uploaded_file = st.file_uploader("Upload your TSV file with results", type=['tsv', 'txt'], label_visibility="collapsed")
|
| 506 |
-
uploaded_file = uploader("Upload your TSV file with results", key="chunk_uploader", chunk_size=1)
|
| 507 |
-
|
| 508 |
-
# Step 3
|
| 509 |
-
st.markdown("""
|
| 510 |
-
<div class="instruction-item">
|
| 511 |
-
<div class="instruction-number">3</div>
|
| 512 |
-
<div class="instruction-content">
|
| 513 |
-
<div><b>Calculate Score</b></div>
|
| 514 |
-
<div>
|
| 515 |
-
Click the button below to evaluate your predictions. Scores are calculated using hidden test set ground-truths.
|
| 516 |
-
</div>
|
| 517 |
-
</div>
|
| 518 |
-
</div>
|
| 519 |
-
""", unsafe_allow_html=True)
|
| 520 |
-
|
| 521 |
-
if uploaded_file is not None:
|
| 522 |
-
if st.button("๐งฎ Calculate Score", width="stretch"):
|
| 523 |
-
# Validate format
|
| 524 |
-
with st.spinner("Validating format and calculating score..."):
|
| 525 |
-
is_valid, result = validate_tsv_format(uploaded_file)
|
| 526 |
-
if is_valid:
|
| 527 |
-
# Calculate score using hidden ground-truth
|
| 528 |
-
scores = calculate_score(result)
|
| 529 |
-
if scores is not None:
|
| 530 |
-
# Store in session state
|
| 531 |
-
scores["model"] = "Your Model"
|
| 532 |
-
st.session_state.user_results = scores.to_dict(orient='list')
|
| 533 |
-
st.rerun()
|
| 534 |
-
else:
|
| 535 |
-
st.error(f"๏ฟฝ๏ฟฝ๏ฟฝ Invalid file format: {result}")
|
| 536 |
-
else:
|
| 537 |
-
st.info("๐ Upload a TSV file to calculate your score")
|
| 538 |
-
|
| 539 |
-
# Allow download of results
|
| 540 |
if 'user_results' in st.session_state:
|
| 541 |
user_results = pd.DataFrame(st.session_state.user_results)
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
width="stretch",
|
|
|
|
| 551 |
)
|
| 552 |
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
<div class="instruction-
|
| 557 |
-
|
| 558 |
-
<div
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
|
|
|
| 562 |
</div>
|
| 563 |
</div>
|
| 564 |
-
|
| 565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
|
| 567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
|
| 409 |
return df_summary
|
| 410 |
|
| 411 |
+
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
+
# Header
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
st.markdown("""
|
| 415 |
+
<div class="header-container">
|
| 416 |
+
<h1>NaviTrace Leaderboard</h1>
|
| 417 |
+
<div class="links-container">
|
| 418 |
+
<a href="https://leggedrobotics.github.io/navitrace_webpage/">
|
| 419 |
+
๐ Project
|
| 420 |
+
</a>
|
| 421 |
+
<a href="https://arxiv.org/abs/2510.26909">
|
| 422 |
+
๐ Paper
|
| 423 |
+
</a>
|
| 424 |
+
<a href="https://github.com/leggedrobotics/navitrace_evaluation">
|
| 425 |
+
๐ป Code
|
| 426 |
+
</a>
|
| 427 |
+
<a href="https://huggingface.co/datasets/leggedrobotics/navitrace">
|
| 428 |
+
๐พ Dataset
|
| 429 |
+
</a>
|
| 430 |
</div>
|
| 431 |
</div>
|
| 432 |
""", unsafe_allow_html=True)
|
| 433 |
|
| 434 |
+
# Load data
|
| 435 |
+
df = load_data()
|
| 436 |
|
| 437 |
+
# Add user's model if it exists in session state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
if 'user_results' in st.session_state:
|
| 439 |
user_results = pd.DataFrame(st.session_state.user_results)
|
| 440 |
+
df = pd.concat([user_results, df], ignore_index=True)
|
| 441 |
+
|
| 442 |
+
# View selector
|
| 443 |
+
view_type = st.selectbox(
|
| 444 |
+
"Select View",
|
| 445 |
+
["Total Score", "Per Embodiment", "Per Category"],
|
| 446 |
+
)
|
| 447 |
+
|
| 448 |
+
# Display chart
|
| 449 |
+
fig = create_bar_chart(df, view_type)
|
| 450 |
+
st.plotly_chart(fig, use_container_width=True, config={
|
| 451 |
+
'displayModeBar': True,
|
| 452 |
+
'displaylogo': False,
|
| 453 |
+
'toImageButtonOptions': {
|
| 454 |
+
'format': 'png',
|
| 455 |
+
'filename': 'navitrace_leaderboard',
|
| 456 |
+
'height': 600,
|
| 457 |
+
'width': 1200,
|
| 458 |
+
'scale': 2
|
| 459 |
+
}
|
| 460 |
+
})
|
| 461 |
+
|
| 462 |
+
# Detailed table
|
| 463 |
+
with st.expander("View Detailed Scores"):
|
| 464 |
+
# Create the summary table
|
| 465 |
+
df_summary = create_summary_table(df)
|
| 466 |
+
|
| 467 |
+
# Display table
|
| 468 |
+
st.dataframe(
|
| 469 |
+
df_summary.style.background_gradient(
|
| 470 |
+
cmap="Blues",
|
| 471 |
+
subset=[col for col in df_summary.columns if col != "model"]
|
| 472 |
+
).format("{:.2f}", subset=[col for col in df_summary.columns if col != "model"]),
|
| 473 |
width="stretch",
|
| 474 |
+
hide_index=True,
|
| 475 |
)
|
| 476 |
|
| 477 |
+
with st.expander("How to Test Your Model", expanded=True):
|
| 478 |
+
# Step 1
|
| 479 |
+
st.markdown("""
|
| 480 |
+
<div class="instruction-item">
|
| 481 |
+
<div class="instruction-number">1</div>
|
| 482 |
+
<div class="instruction-content">
|
| 483 |
+
<div><b>Run Evaluation</b></div>
|
| 484 |
+
<div>
|
| 485 |
+
Download and run our evaluation notebook adjusted to your model. The notebook will generate a TSV file with your model's predictions on the test set.
|
| 486 |
+
</div>
|
| 487 |
</div>
|
| 488 |
</div>
|
| 489 |
+
""", unsafe_allow_html=True)
|
| 490 |
+
|
| 491 |
+
st.link_button("๐ Open Evaluation Notebook", "https://github.com/leggedrobotics/navitrace_evaluation", width="stretch")
|
| 492 |
+
|
| 493 |
+
# Step 2
|
| 494 |
+
st.markdown("""
|
| 495 |
+
<div class="instruction-item">
|
| 496 |
+
<div class="instruction-number">2</div>
|
| 497 |
+
<div class="instruction-content">
|
| 498 |
+
<div><b>Upload Results</b></div>
|
| 499 |
+
<div>
|
| 500 |
+
Upload the TSV file generated by the evaluation notebook.
|
| 501 |
+
</div>
|
| 502 |
+
</div>
|
| 503 |
+
</div>
|
| 504 |
+
""", unsafe_allow_html=True)
|
| 505 |
+
|
| 506 |
+
# Chunk uploaded file to circumvent HF limit
|
| 507 |
+
#uploaded_file = st.file_uploader("Upload your TSV file with results", type=['tsv', 'txt'], label_visibility="collapsed")
|
| 508 |
+
uploaded_file = uploader("", key="chunk_uploader", chunk_size=1)
|
| 509 |
+
|
| 510 |
+
# Step 3
|
| 511 |
+
st.markdown("""
|
| 512 |
+
<div class="instruction-item">
|
| 513 |
+
<div class="instruction-number">3</div>
|
| 514 |
+
<div class="instruction-content">
|
| 515 |
+
<div><b>Calculate Score</b></div>
|
| 516 |
+
<div>
|
| 517 |
+
Click the button below to evaluate your predictions. Scores are calculated using hidden test set ground-truths.
|
| 518 |
+
</div>
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
""", unsafe_allow_html=True)
|
| 522 |
+
|
| 523 |
+
if uploaded_file is not None:
|
| 524 |
+
if st.button("๐งฎ Calculate Score", width="stretch"):
|
| 525 |
+
# Validate format
|
| 526 |
+
with st.spinner("Validating format and calculating score..."):
|
| 527 |
+
is_valid, result = validate_tsv_format(uploaded_file)
|
| 528 |
+
if is_valid:
|
| 529 |
+
# Calculate score using hidden ground-truth
|
| 530 |
+
scores = calculate_score(result)
|
| 531 |
+
if scores is not None:
|
| 532 |
+
# Store in session state
|
| 533 |
+
scores["model"] = "Your Model"
|
| 534 |
+
st.session_state.user_results = scores.to_dict(orient='list')
|
| 535 |
+
st.rerun()
|
| 536 |
+
else:
|
| 537 |
+
st.error(f"โ Invalid file format: {result}")
|
| 538 |
+
else:
|
| 539 |
+
st.info("๐ Upload a TSV file to calculate your score")
|
| 540 |
|
| 541 |
+
# Allow download of results
|
| 542 |
+
if 'user_results' in st.session_state:
|
| 543 |
+
user_results = pd.DataFrame(st.session_state.user_results)
|
| 544 |
+
st.success(f"โ
Score calculated successfully: **{user_results['score'].mean():.1f}**")
|
| 545 |
+
st.info("๐ Scroll up to see your model on the leaderboard!")
|
| 546 |
+
tsv_data = convert_df_to_tsv(user_results)
|
| 547 |
+
st.download_button(
|
| 548 |
+
label="๐
Download Score",
|
| 549 |
+
data=tsv_data,
|
| 550 |
+
file_name='scores.tsv',
|
| 551 |
+
mime='text/tab-separated-values',
|
| 552 |
+
width="stretch",
|
| 553 |
+
)
|
| 554 |
+
|
| 555 |
+
# Step 4
|
| 556 |
+
st.markdown("""
|
| 557 |
+
<div class="instruction-item">
|
| 558 |
+
<div class="instruction-number">4</div>
|
| 559 |
+
<div class="instruction-content">
|
| 560 |
+
<div><b>Submit to Official Leaderboard</b></div>
|
| 561 |
+
<div>
|
| 562 |
+
Happy with your score? Submit your model to appear on the official leaderboard.
|
| 563 |
+
Fill out the form below with your model details and results.
|
| 564 |
+
</div>
|
| 565 |
+
</div>
|
| 566 |
+
</div>
|
| 567 |
+
""", unsafe_allow_html=True)
|
| 568 |
+
|
| 569 |
+
st.link_button("๐ณ๏ธ Submit Model", "https://docs.google.com/forms/d/e/1FAIpQLSfcAQ6JW7eey-8OFSAz2ea_StCezxJK1dt6mjW_wR-9jCHnXg/viewform?usp=dialog", width="stretch")
|
| 570 |
+
|
| 571 |
+
if __name__ == "__main__":
|
| 572 |
+
main()
|