hemantvirmani commited on
Commit
5f04c51
·
1 Parent(s): a0b1b1d

simple changes for moving everything to main fn.

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- import sys
3
  import argparse
4
  import requests
5
  import pandas as pd
@@ -351,7 +350,8 @@ def run_test_code(filter=None):
351
  return pd.DataFrame(results_for_display)
352
 
353
 
354
- if __name__ == "__main__":
 
355
  parser = argparse.ArgumentParser(description="Run the agent application.")
356
  parser.add_argument("--test", action="store_true", help="Run local tests on selected questions and exit.")
357
  parser.add_argument("--testall", action="store_true", help="Run local tests on all questions and exit.")
@@ -383,12 +383,12 @@ if __name__ == "__main__":
383
  print("-"*(60 + len(" App Starting ")) + "\n")
384
 
385
  # Execute based on run mode
386
- if run_mode == RunMode.UI: # Launch Gradio UI
387
  print("Launching Gradio Interface for Basic Agent Evaluation...")
388
  grTestApp = create_ui(run_and_submit_all, run_test_code)
389
  grTestApp.launch()
390
 
391
- else # run_mode == RunMode.CLI:
392
  # Determine test filter based on which CLI flag was used
393
  if args.test:
394
  # Specify question indices to test
@@ -411,3 +411,7 @@ if __name__ == "__main__":
411
  print(val)
412
  else:
413
  print(result)
 
 
 
 
 
1
  import os
 
2
  import argparse
3
  import requests
4
  import pandas as pd
 
350
  return pd.DataFrame(results_for_display)
351
 
352
 
353
+ def main():
354
+ """Main entry point for the application."""
355
  parser = argparse.ArgumentParser(description="Run the agent application.")
356
  parser.add_argument("--test", action="store_true", help="Run local tests on selected questions and exit.")
357
  parser.add_argument("--testall", action="store_true", help="Run local tests on all questions and exit.")
 
383
  print("-"*(60 + len(" App Starting ")) + "\n")
384
 
385
  # Execute based on run mode
386
+ if run_mode == RunMode.UI:
387
  print("Launching Gradio Interface for Basic Agent Evaluation...")
388
  grTestApp = create_ui(run_and_submit_all, run_test_code)
389
  grTestApp.launch()
390
 
391
+ else: # RunMode.CLI
392
  # Determine test filter based on which CLI flag was used
393
  if args.test:
394
  # Specify question indices to test
 
411
  print(val)
412
  else:
413
  print(result)
414
+
415
+
416
+ if __name__ == "__main__":
417
+ main()