1111
1212port = '/dev/ttyUSB3'
1313baudrate = '921600'
14+ exe_path = "/usr/bin/tsi/v0.1.1.tsv31_06_06_2025/bin/"
1415
1516@app .route ('/' )
1617def index ():
@@ -49,8 +50,8 @@ def llama_cli_serial_command():
4950 #]
5051 # URL to Test this end point is as follows
5152 # http://10.50.30.167:5001/llama-cli?model=tiny-llama&backend=tSavorite&tokens=5&prompt=Hello+How+are+you
52- script_path = "/usr/bin/tsi/v0.1.1.tsv31_06_06_2025/bin /run_llama_cli.sh"
53- command = f"{ script_path } \" { prompt } \" { tokens } { model_path } { backend } "
53+ script_path = ". /run_llama_cli.sh"
54+ command = f"cd { exe_path } ; { script_path } \" { prompt } \" { tokens } { model_path } { backend } "
5455
5556 try :
5657 result = subprocess .run (['python3' , 'serial_script.py' , port , baudrate , command ], capture_output = True , text = True , check = True )
@@ -109,11 +110,17 @@ def upload_file():
109110
110111@app .route ('/restart-txe' , methods = ['GET' ])
111112def restart_txe_serial_command ():
112- command = f"telnet localhost 8000; close all"
113+ command = f"telnet localhost 8000\r \n close all\r \n "
113114
114115 try :
115116 result = subprocess .run (['python3' , 'serial_script.py' , port , baudrate , command ], capture_output = True , text = True , check = True )
116- return result .stdout , 200
117+ time .sleep (5 )
118+ command = f"{ exe_path } /../install/tsi-start\n yes\n "
119+ try :
120+ result = subprocess .run (['python3' , 'serial_script.py' , port , baudrate , command ], capture_output = True , text = True , check = True )
121+ return result .stdout , 200
122+ except subprocess .CalledProcessError as e :
123+ return f"Error executing script: { e .stderr } " , 500
117124 except subprocess .CalledProcessError as e :
118125 return f"Error executing script: { e .stderr } " , 500
119126
@@ -140,7 +147,7 @@ def test_serial_command():
140147@app .route ('/system-info' , methods = ['GET' ])
141148def system_info_serial_command ():
142149
143- command = f"lscpu"
150+ command = f"{ exe_path } ../install/tsi-version; lscpu"
144151
145152 try :
146153 result = subprocess .run (['python3' , 'serial_script.py' , port , baudrate , command ], capture_output = True , text = True , check = True )
@@ -184,8 +191,8 @@ def submit():
184191 # "--top-p", "1"
185192 #]
186193
187- script_path = "/usr/bin/tsi/v0.1.1.tsv31_06_06_2025/bin /run_llama_cli.sh"
188- command = f"{ script_path } \" { prompt } \" { tokens } { model_path } { backend } "
194+ script_path = ". /run_llama_cli.sh"
195+ command = f"cd { exe_path } ; { script_path } \" { prompt } \" { tokens } { model_path } { backend } "
189196
190197
191198 def run_script ():
0 commit comments