@@ -570,47 +570,35 @@ def parse_heldout(heldout_str: str) -> list:
570570
571571
572572@main .command ()
573- @click .option ("--port" , default = 8888 , help = "Port to run the dashboard on" )
574- @click .option ("--host" , default = "localhost " , help = "Host to run the dashboard on" )
573+ @click .option ("--port" , default = 5000 , help = "Port to run the dashboard on" )
574+ @click .option ("--host" , default = "0.0.0.0 " , help = "Host to run the dashboard on" )
575575def dash (port : int , host : str ) -> None :
576- """Launch the interactive Streamlit dashboard for visualizing language emergence."""
576+ """Launch the Flask dashboard for visualizing language emergence."""
577+ import os
577578 import subprocess
578579 import sys
579- import os
580+ from pathlib import Path
580581
581- # Get the path to the app.py file
582- app_path = os . path . join ( os . path . dirname ( __file__ ), "app .py")
582+ dashboard_dir = Path ( __file__ ). parent . parent . parent . parent / "dashboard"
583+ app_path = dashboard_dir / "main .py"
583584
584- if not os . path . exists (app_path ):
585- click .echo ("Error: Dashboard app not found" , err = True )
585+ if not app_path . exists ():
586+ click .echo ("Error: Dashboard not found at dashboard/main.py " , err = True )
586587 return
587588
588589 logger .info (f"Launching dashboard on { host } :{ port } " )
589590 click .echo ("Launching Language Emergence Dashboard..." )
590- click .echo (f"Dashboard will be available at: http://{ host } :{ port } " )
591+ click .echo (f"Dashboard will be available at: http://localhost :{ port } " )
591592 click .echo ("Press Ctrl+C to stop the dashboard" )
592593
593594 try :
594- # Launch Streamlit
595- cmd = [
596- sys .executable ,
597- "-m" ,
598- "streamlit" ,
599- "run" ,
600- app_path ,
601- "--server.headless" ,
602- "true" ,
603- "--server.port" ,
604- str (port ),
605- "--server.address" ,
606- host ,
607- ]
608- subprocess .run (cmd , check = True )
595+ cmd = [sys .executable , str (app_path )]
596+ env = {** os .environ , "FLASK_RUN_PORT" : str (port ), "FLASK_RUN_HOST" : host }
597+ subprocess .run (cmd , check = True , env = env )
609598 except subprocess .CalledProcessError as e :
610599 logger .error (f"Failed to launch dashboard: { e } " )
611600 click .echo (
612- "Error: Failed to launch dashboard. Make sure Streamlit is installed." ,
613- err = True ,
601+ "Error: Failed to launch dashboard. Make sure Flask is installed." , err = True
614602 )
615603 except KeyboardInterrupt :
616604 click .echo ("\n Dashboard stopped." )
0 commit comments