Clémentine commited on
Commit
31c57c2
·
1 Parent(s): 9252209
Files changed (1) hide show
  1. app.py +39 -17
app.py CHANGED
@@ -28,22 +28,30 @@ def create_app() -> gr.Blocks:
28
  gr.Markdown("# Inference Provider Testing Dashboard")
29
  gr.Markdown("Launch and monitor evaluation jobs for multiple models and providers.")
30
 
31
- # Simplified action buttons - only essential ones
32
  with gr.Row():
33
- launch_btn = gr.Button("Launch All Jobs", variant="primary", scale=2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  relaunch_failed_btn = gr.Button("Relaunch Failed", variant="stop", scale=1)
35
 
36
  output = gr.Textbox(label="Status", interactive=False)
37
 
38
- # Accordion for viewing/editing models/providers list and initialization
39
- with gr.Accordion("Models/Providers Configuration", open=False):
40
- init_btn = gr.Button("Fetch and Initialize Models/Providers", variant="secondary")
41
- models_providers_display = gr.Code(
42
- label="Current Models and Providers",
43
- value=load_models_providers_str(),
44
- interactive=False,
45
- )
46
-
47
  # Summary statistics
48
  summary_stats = gr.Markdown(value=get_summary_stats())
49
 
@@ -64,9 +72,22 @@ def create_app() -> gr.Blocks:
64
 
65
 
66
  # Event handlers
67
- init_btn.click(
68
- fn=initialize_models_providers_file,
69
- outputs=[output, models_providers_display]
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  )
71
 
72
  def launch_and_update():
@@ -122,11 +143,12 @@ def create_app() -> gr.Blocks:
122
  """Auto-refresh table and summary stats."""
123
  return get_results_table(), get_summary_stats()
124
 
125
- demo.load(
 
 
126
  fn=auto_refresh,
127
  inputs=[],
128
- outputs=[results_table, summary_stats],
129
- every=30
130
  )
131
  with gr.Tab("About"):
132
  gr.Markdown("""
 
28
  gr.Markdown("# Inference Provider Testing Dashboard")
29
  gr.Markdown("Launch and monitor evaluation jobs for multiple models and providers.")
30
 
31
+ # Manual job launch section
32
  with gr.Row():
33
+ with gr.Column(scale=2):
34
+ model_input = gr.Textbox(
35
+ label="Model",
36
+ placeholder="e.g., meta-llama/Llama-3.3-70B-Instruct",
37
+ info="Enter HuggingFace model ID"
38
+ )
39
+ with gr.Column(scale=1):
40
+ provider_input = gr.Textbox(
41
+ label="Provider",
42
+ placeholder="e.g., together-ai",
43
+ info="Enter inference provider name"
44
+ )
45
+ with gr.Column(scale=1):
46
+ launch_single_btn = gr.Button("Launch Job", variant="primary")
47
+
48
+ # Batch action buttons
49
+ with gr.Row():
50
+ launch_btn = gr.Button("Launch All Jobs", variant="secondary", scale=2)
51
  relaunch_failed_btn = gr.Button("Relaunch Failed", variant="stop", scale=1)
52
 
53
  output = gr.Textbox(label="Status", interactive=False)
54
 
 
 
 
 
 
 
 
 
 
55
  # Summary statistics
56
  summary_stats = gr.Markdown(value=get_summary_stats())
57
 
 
72
 
73
 
74
  # Event handlers
75
+ def launch_single_and_update(model: str, provider: str):
76
+ """Launch a single job and return updated table and stats."""
77
+ if not model or not provider:
78
+ return "❌ Please provide both model and provider", get_results_table(), get_summary_stats()
79
+
80
+ job_id = run_single_job(model, provider, globals.TASKS)
81
+ if job_id == -1:
82
+ return "❌ Failed to launch job (may already be running)", get_results_table(), get_summary_stats()
83
+
84
+ save_results()
85
+ return f"✅ Launched job for {model} on {provider} (ID: {job_id})", get_results_table(), get_summary_stats()
86
+
87
+ launch_single_btn.click(
88
+ fn=launch_single_and_update,
89
+ inputs=[model_input, provider_input],
90
+ outputs=[output, results_table, summary_stats]
91
  )
92
 
93
  def launch_and_update():
 
143
  """Auto-refresh table and summary stats."""
144
  return get_results_table(), get_summary_stats()
145
 
146
+ # Create a timer for auto-refresh
147
+ timer = gr.Timer(value=30, active=True)
148
+ timer.tick(
149
  fn=auto_refresh,
150
  inputs=[],
151
+ outputs=[results_table, summary_stats]
 
152
  )
153
  with gr.Tab("About"):
154
  gr.Markdown("""