WilliamRabuel commited on
Commit
5bc9a66
·
verified ·
1 Parent(s): cb292a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -136,6 +136,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
136
  return status_message, results_df
137
 
138
 
 
139
  # --- Build Gradio Interface using Blocks ---
140
  with gr.Blocks() as demo:
141
  gr.Markdown("# Basic Agent Evaluation Runner")
@@ -153,9 +154,8 @@ with gr.Blocks() as demo:
153
  This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
154
  """
155
  )
156
-
157
- # Utilisez gr.LoginButton() si vous utilisez une version de Gradio qui le supporte.
158
- # Sinon, assurez-vous que les utilisateurs peuvent s'authentifier d'une manière ou d'une autre.
159
  login_button = gr.LoginButton()
160
 
161
  run_button = gr.Button("Run Evaluation & Submit All Answers")
@@ -163,24 +163,29 @@ with gr.Blocks() as demo:
163
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
164
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
165
 
 
 
 
 
 
166
  run_button.click(
167
  fn=run_and_submit_all,
168
- inputs=[login_button], # L'input est le profil retourné par le bouton de connexion
169
  outputs=[status_output, results_table]
170
  )
171
 
172
-
173
  if __name__ == "__main__":
174
  print("\n" + "-"*30 + " App Starting " + "-"*30)
 
175
  space_host_startup = os.getenv("SPACE_HOST")
176
- space_id_startup = os.getenv("SPACE_ID")
177
 
178
  if space_host_startup:
179
  print(f"✅ SPACE_HOST found: {space_host_startup}")
180
  else:
181
  print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
182
 
183
- if space_id_startup:
184
  print(f"✅ SPACE_ID found: {space_id_startup}")
185
  print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
186
  else:
 
136
  return status_message, results_df
137
 
138
 
139
+ # --- Build Gradio Interface using Blocks ---
140
  # --- Build Gradio Interface using Blocks ---
141
  with gr.Blocks() as demo:
142
  gr.Markdown("# Basic Agent Evaluation Runner")
 
154
  This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
155
  """
156
  )
157
+
158
+ # 1. On assigne le bouton de connexion à une variable pour pouvoir l'utiliser comme entrée
 
159
  login_button = gr.LoginButton()
160
 
161
  run_button = gr.Button("Run Evaluation & Submit All Answers")
 
163
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
164
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
165
 
166
+ # 2. On corrige l'appel .click()
167
+ # - 'fn' est la fonction à appeler.
168
+ # - 'inputs' est une liste des composants dont la valeur est passée à 'fn'.
169
+ # Ici, on passe uniquement le profil de l'utilisateur depuis le bouton de connexion.
170
+ # - 'outputs' sont les composants qui afficheront le résultat.
171
  run_button.click(
172
  fn=run_and_submit_all,
173
+ inputs=[login_button],
174
  outputs=[status_output, results_table]
175
  )
176
 
 
177
  if __name__ == "__main__":
178
  print("\n" + "-"*30 + " App Starting " + "-"*30)
179
+ # Check for SPACE_HOST and SPACE_ID at startup for information
180
  space_host_startup = os.getenv("SPACE_HOST")
181
+ space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
182
 
183
  if space_host_startup:
184
  print(f"✅ SPACE_HOST found: {space_host_startup}")
185
  else:
186
  print("ℹ️ SPACE_HOST environment variable not found (running locally?).")
187
 
188
+ if space_id_startup: # Print repo URLs if SPACE_ID is found
189
  print(f"✅ SPACE_ID found: {space_id_startup}")
190
  print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")
191
  else: