akiko19191 commited on
Commit
f65d06b
·
verified ·
1 Parent(s): 2bfc584

Update tests.py

Browse files
Files changed (1) hide show
  1. tests.py +8 -12
tests.py CHANGED
@@ -236,24 +236,20 @@ def run_code(python_packages:str,filename: str, code: str,start_cmd:str,forever_
236
  - All user-uploaded files are in /app/code_interpreter/.
237
  - After execution, embed a download link (or display images/gifs/videos directly in markdown format) in your response.
238
  """
239
-
240
- global files_list
241
  package_names = python_packages.strip()
242
  command="pip install"
243
- # if not package_names:
244
- # pass
245
- # else:
246
- # run(
247
- # f"{command} --break-system-packages {package_names}", timeout_sec=300
248
- # )
249
- global destination_dir
250
  download_all_files("https://opengpt-4ik5.onrender.com", "/upload", "/app/code_interpreter")
251
  transfer_files()
252
  f = open(os.path.join(destination_dir, filename), "w")
253
  f.write(code)
254
  f.close()
255
- stdot=run(start_cmd, 300,forever_cmd)
256
-
257
  onlyfiles = glob.glob("/app/code_interpreter/*")
258
  onlyfiles=list(set(onlyfiles)-set(files_list))
259
  uploaded_filenames=[]
@@ -271,6 +267,7 @@ def run_code(python_packages:str,filename: str, code: str,start_cmd:str,forever_
271
  def run_code_files(start_cmd:str) -> dict:
272
  """(start_cmd:Example- python /app/code_interpreter/app.py or bash /app/code_interpreter/app.py).The files must be inside the /app/code_interpreter directory."""
273
  global files_list
 
274
  stdot=run(start_cmd, 300)
275
  onlyfiles = glob.glob("/app/code_interpreter/*")
276
  onlyfiles=list(set(onlyfiles)-set(files_list))
@@ -421,4 +418,3 @@ def deepthinking3(query:str,info:str) -> dict:
421
  if __name__ == "__main__":
422
  # Initialize and run the server
423
  mcp.run(transport='stdio')
424
-
 
236
  - All user-uploaded files are in /app/code_interpreter/.
237
  - After execution, embed a download link (or display images/gifs/videos directly in markdown format) in your response.
238
  """
239
+ global destination_dir
 
240
  package_names = python_packages.strip()
241
  command="pip install"
242
+ if package_names != "" or package_names != " ":
243
+ stdot=run(
244
+ f"{command} --break-system-packages {package_names}", timeout_sec=300
245
+ )
 
 
 
246
  download_all_files("https://opengpt-4ik5.onrender.com", "/upload", "/app/code_interpreter")
247
  transfer_files()
248
  f = open(os.path.join(destination_dir, filename), "w")
249
  f.write(code)
250
  f.close()
251
+ global files_list
252
+ stdot=run(start_cmd, 300)
253
  onlyfiles = glob.glob("/app/code_interpreter/*")
254
  onlyfiles=list(set(onlyfiles)-set(files_list))
255
  uploaded_filenames=[]
 
267
  def run_code_files(start_cmd:str) -> dict:
268
  """(start_cmd:Example- python /app/code_interpreter/app.py or bash /app/code_interpreter/app.py).The files must be inside the /app/code_interpreter directory."""
269
  global files_list
270
+
271
  stdot=run(start_cmd, 300)
272
  onlyfiles = glob.glob("/app/code_interpreter/*")
273
  onlyfiles=list(set(onlyfiles)-set(files_list))
 
418
  if __name__ == "__main__":
419
  # Initialize and run the server
420
  mcp.run(transport='stdio')