Spaces:
Sleeping
Sleeping
File size: 2,000 Bytes
adecc9b 673a52e adecc9b 673a52e adecc9b 673a52e adecc9b 673a52e adecc9b 673a52e adecc9b 673a52e adecc9b 673a52e adecc9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
"""
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()
|