MilanM commited on
Commit
50298a1
·
verified ·
1 Parent(s): bb9bbc6

Update main_app.py

Browse files
Files changed (1) hide show
  1. main_app.py +11 -11
main_app.py CHANGED
@@ -70,10 +70,10 @@ def _(os):
70
  pd.set_option('display.width', None)
71
 
72
  # Set explicit temporary directory
73
- os.environ['TMPDIR'] = '/tmp'
74
 
75
  # Make sure Python's tempfile module also uses this directory
76
- tempfile.tempdir = '/tmp'
77
  return (
78
  Any,
79
  Dict,
@@ -818,24 +818,24 @@ def _(
818
  function_object = getattr(module, func_name)
819
 
820
  # Change to /tmp directory before calling IBM Watson SDK functions
821
- os.chdir('/tmp')
822
 
823
  # Upload the function object
824
  mo.md(f"Uploading function object: {func_name}")
825
  func_details = deployment_client.repository.store_function(function_object, function_meta)
826
  else:
827
  # Change to /tmp directory before calling IBM Watson SDK functions
828
- os.chdir('/tmp')
829
 
830
- # Upload using the absolute file path
831
- abs_file_path = os.path.abspath(file_path)
832
- mo.md(f"Uploading function from file: {abs_file_path}")
833
 
834
- # Using the absolute file path might help in some environments
835
- func_details = deployment_client.repository.store_function(abs_file_path, function_meta)
836
  # Upload using the file path approach
837
- # mo.md(f"Uploading function from file: {file_path}")
838
- # func_details = deployment_client.repository.store_function(file_path, function_meta)
839
 
840
  set_upload_status(f"Latest Upload - id - {func_details['metadata']['id']}")
841
  return func_details
 
70
  pd.set_option('display.width', None)
71
 
72
  # Set explicit temporary directory
73
+ os.environ['TMPDIR'] = '/tmp/notebook_functions'
74
 
75
  # Make sure Python's tempfile module also uses this directory
76
+ tempfile.tempdir = '/tmp/notebook_functions'
77
  return (
78
  Any,
79
  Dict,
 
818
  function_object = getattr(module, func_name)
819
 
820
  # Change to /tmp directory before calling IBM Watson SDK functions
821
+ os.chdir('/tmp/notebook_functions')
822
 
823
  # Upload the function object
824
  mo.md(f"Uploading function object: {func_name}")
825
  func_details = deployment_client.repository.store_function(function_object, function_meta)
826
  else:
827
  # Change to /tmp directory before calling IBM Watson SDK functions
828
+ os.chdir('/tmp/notebook_functions')
829
 
830
+ # # Upload using the absolute file path
831
+ # abs_file_path = os.path.abspath(file_path)
832
+ # mo.md(f"Uploading function from file: {abs_file_path}")
833
 
834
+ # # Using the absolute file path might help in some environments
835
+ # func_details = deployment_client.repository.store_function(abs_file_path, function_meta)
836
  # Upload using the file path approach
837
+ mo.md(f"Uploading function from file: {file_path}")
838
+ func_details = deployment_client.repository.store_function(file_path, function_meta)
839
 
840
  set_upload_status(f"Latest Upload - id - {func_details['metadata']['id']}")
841
  return func_details