Skip to content
Snippets Groups Projects
Commit 980c3ed7 authored by DIANE's avatar DIANE
Browse files

temporary directory suppression

parent 45a4a313
No related branches found
No related tags found
No related merge requests found
......@@ -29,14 +29,17 @@ with c1:
zip = st.file_uploader("Load your zip file:", type=[
'.zip'], help=" :mushroom: select a csv matrix with samples as rows and lambdas as columns")
if zip:
def tempdir(prefix, dir):
from tempfile import TemporaryDirectory
# create a temp directory
with TemporaryDirectory(prefix=prefix, dir=dir) as temp_dir:
tempdirname = os.path.split(temp_dir)[1]
return tempdirname
temp_dir = tempdir(prefix="pred_temp", dir="./temp")
# def tempdir(prefix, dir):
# from tempfile import TemporaryDirectory
# # create a temp directory
# with TemporaryDirectory(prefix=prefix, dir=dir) as temp_dir:
# tempdirname = os.path.split(temp_dir)[1]
# return tempdirname
from tempfile import TemporaryDirectory
# create a temp directory
with TemporaryDirectory(prefix="pred_temp", dir="./temp") as temp_dir:
tempdirname = os.path.split(temp_dir)[1]
# Open and extract the zip file
from zipfile import ZipFile
with ZipFile(zip, 'r') as zip_ref:
......@@ -373,5 +376,7 @@ if not result.empty:
tempdirname, zip_data = tempdir(change=hash_)
st.download_button(label='Download', data=zip_data, file_name=f'Nirs_Workflow_{date_time}_Pred_.zip', mime="application/zip",
args=None, kwargs=None, type="primary", use_container_width=True)
HandleItems.delete_files(keep=['.py', '.pyc', '.bib'])
except:
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment