Spaces:
Sleeping
Sleeping
| """ | |
| BioFlow UI Launch Script | |
| ========================= | |
| Quick launcher for the BioFlow Next.js application. | |
| Usage: | |
| python launch_ui.py | |
| python launch_ui.py --port 3001 | |
| python launch_ui.py --debug | |
| """ | |
| import subprocess | |
| import sys | |
| import os | |
| from pathlib import Path | |
| def main(): | |
| """Launch the BioFlow UI.""" | |
| script_dir = Path(__file__).parent | |
| ui_dir = script_dir / "ui" | |
| if not (ui_dir / "package.json").exists(): | |
| print(f"β Error: Next.js UI not found at {ui_dir}") | |
| sys.exit(1) | |
| # Parse arguments | |
| port = 3000 | |
| debug = False | |
| for i, arg in enumerate(sys.argv[1:]): | |
| if arg == "--port" and i + 1 < len(sys.argv[1:]): | |
| port = int(sys.argv[i + 2]) | |
| elif arg == "--debug": | |
| debug = True | |
| env = os.environ.copy() | |
| env["PORT"] = str(port) | |
| if debug: | |
| env["NODE_OPTIONS"] = env.get("NODE_OPTIONS", "") + " --trace-warnings" | |
| print(f""" | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β β | |
| β 𧬠BioFlow - AI-Powered Drug Discovery Platform β | |
| β β | |
| β Starting server at http://localhost:{port} β | |
| β β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| """) | |
| try: | |
| subprocess.run(["pnpm", "dev"], cwd=str(ui_dir), env=env, check=False) | |
| except KeyboardInterrupt: | |
| print("\n\nπ BioFlow server stopped.") | |
| except Exception as e: | |
| print(f"β Error launching BioFlow: {e}") | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| main() | |