Spaces:
Running
Running
Anthony Liang commited on
Commit ·
d70a728
1
Parent(s): d8adb0b
collapse side bar
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +31 -7
__pycache__/app.cpython-311.pyc
ADDED
|
Binary file (63.4 kB). View file
|
|
|
app.py
CHANGED
|
@@ -606,15 +606,20 @@ except TypeError:
|
|
| 606 |
demo = gr.Blocks(title="RFM Evaluation Server")
|
| 607 |
|
| 608 |
with demo:
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 614 |
|
| 615 |
# Hidden state to store server URL and model mapping (define before use)
|
| 616 |
server_url_state = gr.State(value=None)
|
| 617 |
model_url_mapping_state = gr.State(value={}) # Maps model_name -> server_url
|
|
|
|
| 618 |
|
| 619 |
# Function definitions for event handlers
|
| 620 |
def discover_and_select_models(base_url: str):
|
|
@@ -697,10 +702,22 @@ with demo:
|
|
| 697 |
server_url,
|
| 698 |
)
|
| 699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
# Main layout with sidebar and content area
|
| 701 |
with gr.Row():
|
| 702 |
-
# Sidebar for model selection and info
|
| 703 |
-
|
|
|
|
| 704 |
gr.Markdown("### 🔧 Model Configuration")
|
| 705 |
|
| 706 |
base_url_input = gr.Textbox(
|
|
@@ -744,6 +761,13 @@ with demo:
|
|
| 744 |
|
| 745 |
# Main content area with tabs
|
| 746 |
with gr.Column(scale=4):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 747 |
with gr.Tabs():
|
| 748 |
with gr.Tab("Progress Prediction"):
|
| 749 |
gr.Markdown("### Progress & Success Prediction")
|
|
|
|
| 606 |
demo = gr.Blocks(title="RFM Evaluation Server")
|
| 607 |
|
| 608 |
with demo:
|
| 609 |
+
# Header with title and toggle button
|
| 610 |
+
with gr.Row():
|
| 611 |
+
sidebar_toggle_btn = gr.Button("☰ Toggle Sidebar", variant="secondary", size="sm", elem_id="sidebar-toggle")
|
| 612 |
+
gr.Markdown(
|
| 613 |
+
"""
|
| 614 |
+
# RFM (Reward Foundation Model) Evaluation Server
|
| 615 |
+
""",
|
| 616 |
+
elem_id="main-title",
|
| 617 |
+
)
|
| 618 |
|
| 619 |
# Hidden state to store server URL and model mapping (define before use)
|
| 620 |
server_url_state = gr.State(value=None)
|
| 621 |
model_url_mapping_state = gr.State(value={}) # Maps model_name -> server_url
|
| 622 |
+
sidebar_visible_state = gr.State(value=True) # Track sidebar visibility
|
| 623 |
|
| 624 |
# Function definitions for event handlers
|
| 625 |
def discover_and_select_models(base_url: str):
|
|
|
|
| 702 |
server_url,
|
| 703 |
)
|
| 704 |
|
| 705 |
+
# Toggle function for sidebar
|
| 706 |
+
def toggle_sidebar(visible):
|
| 707 |
+
"""Toggle sidebar visibility."""
|
| 708 |
+
new_visible = not visible
|
| 709 |
+
button_text = "☰ Show Sidebar" if not new_visible else "☰ Hide Sidebar"
|
| 710 |
+
return (
|
| 711 |
+
new_visible,
|
| 712 |
+
gr.update(visible=new_visible),
|
| 713 |
+
gr.update(value=button_text),
|
| 714 |
+
)
|
| 715 |
+
|
| 716 |
# Main layout with sidebar and content area
|
| 717 |
with gr.Row():
|
| 718 |
+
# Sidebar for model selection and info (controlled by visibility state)
|
| 719 |
+
sidebar_column = gr.Column(scale=1, min_width=300, visible=True)
|
| 720 |
+
with sidebar_column:
|
| 721 |
gr.Markdown("### 🔧 Model Configuration")
|
| 722 |
|
| 723 |
base_url_input = gr.Textbox(
|
|
|
|
| 761 |
|
| 762 |
# Main content area with tabs
|
| 763 |
with gr.Column(scale=4):
|
| 764 |
+
# Wire up the toggle button
|
| 765 |
+
sidebar_toggle_btn.click(
|
| 766 |
+
fn=toggle_sidebar,
|
| 767 |
+
inputs=[sidebar_visible_state],
|
| 768 |
+
outputs=[sidebar_visible_state, sidebar_column, sidebar_toggle_btn],
|
| 769 |
+
)
|
| 770 |
+
|
| 771 |
with gr.Tabs():
|
| 772 |
with gr.Tab("Progress Prediction"):
|
| 773 |
gr.Markdown("### Progress & Success Prediction")
|