Hi ,
Thanks for reaching out to Microsoft Q&A.
You can convert the 'StorageStreamDownloader' object into a 'joblib' object or a Pandas df. For this, you need to read the data from the stream and then process it accordingly.
Try the below modified script locally in vscode to check if it works, and then use it in your container in ACI.
connection_string =
def download_file_to_memory(connection_string, share_name, filename):
file_client = ShareFileClient.from_connection_string(conn_str=connection_string, share_name=share_name, file_path=filename)
downloader = file_client.download_file()
downloaded_bytes = downloader.readall()
return downloaded_bytes
# Example for CSV file
csv_filename = 'test.csv'
csv_data = download_file_to_memory(connection_string, share_name, csv_filename)
# Read CSV data into a Pandas DataFrame
csv_io = io.BytesIO(csv_data)
df = pd.read_csv(csv_io)
print(df)
# Example for joblib file
joblib_filename = 'model.joblib'
joblib_data = download_file_to_memory(connection_string, share_name, joblib_filename)
# Load joblib data into a Python object
joblib_io = io.BytesIO(joblib_data)
model = joblib.load(joblib_io)
print(model)
Note: the above is purely an example, you will have to modify/add codeblocks or libraries the script to suit your needs.
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.