Skip to content
Snippets Groups Projects
Commit dca49690 authored by BARTHES Nicolas's avatar BARTHES Nicolas
Browse files

updated requirements.txt

updated .gitignore for .streamlit config folder
parent 5ab14688
No related branches found
No related tags found
No related merge requests found
.idea/ .idea/
.streamlit/
GUI_Pinard.iml GUI_Pinard.iml
__pycache__/ __pycache__/
\ No newline at end of file
...@@ -70,7 +70,7 @@ with st.container(): ...@@ -70,7 +70,7 @@ with st.container():
categorical_variable_2 = settings_column.selectbox("Second Variable Select (hover data)", options = cat_cols) categorical_variable_2 = settings_column.selectbox("Second Variable Select (hover data)", options = cat_cols)
plot_pc = scatter_column.plotly_chart(px.scatter(data_frame=pc_data, x=pc_1, y=pc_2, template="simple_white", height=800, color=categorical_variable, hover_data = [categorical_variable_2], hover_name=pc_data.index, title="PC plot of sample spectra")) plot_pc = scatter_column.plotly_chart(px.scatter(data_frame=pc_data, x=pc_1, y=pc_2, template="simple_white", height=800, color=categorical_variable, hover_data = [categorical_variable_2], hover_name=pc_data.index, title="PC plot of sample spectra"))
# Clustering method # Clustering method
cluster_type = ['', 'k-means'] cluster_type = ['', 'k-means', 'umap']
# cluster_type = ['k-means', 'umap'] # uncomment if more clustering algorithms available # cluster_type = ['k-means', 'umap'] # uncomment if more clustering algorithms available
type_cluster = settings_column.selectbox("Clustering method: ", options=cluster_type, key=38) type_cluster = settings_column.selectbox("Clustering method: ", options=cluster_type, key=38)
# clustering via K-Means # clustering via K-Means
...@@ -130,7 +130,7 @@ with st.container(): ...@@ -130,7 +130,7 @@ with st.container():
pd.DataFrame(export).T.to_csv('./data/sample_selections/Samples_from_' + sselectx_csv.name + '_for_Chemical_Analysis.csv') pd.DataFrame(export).T.to_csv('./data/sample_selections/Samples_from_' + sselectx_csv.name + '_for_Chemical_Analysis.csv')
else: else:
scatter_column.write("_Please Choose a file_") scatter_column.write("_Please Choose a file_")
# clustering via UMAP / HDBSCAN # clustering via UMAP / HDBSCAN -- TO BE DONE !!!
if type_cluster == 'umap': if type_cluster == 'umap':
import hdbscan import hdbscan
# plot de pc with colored clusters and selected samples # plot de pc with colored clusters and selected samples
...@@ -204,16 +204,17 @@ with st.container(): ...@@ -204,16 +204,17 @@ with st.container():
model_column.write('Model Imported') model_column.write('Model Imported')
result = '' result = ''
if st.button("Predict"): if st.button("Predict"):
# use prediction function from application_functions.py to predict chemical values
result = prediction(NIRS_csv, qsep, qhdr, model_loaded) result = prediction(NIRS_csv, qsep, qhdr, model_loaded)
st.write('Predicted values are: ') st.write('Predicted values are: ')
st.dataframe(result) st.dataframe(result)
pd.DataFrame(result).to_csv(export_name + '.csv') pd.DataFrame(result).to_csv(export_name + '.csv')
st.write('Predictions exported to ' + export_name + '.csv') st.write('Predictions exported to ' + export_name + '.csv')
# # export to local drive # export to local drive
# from urllib.request import urlretrieve from urllib.request import urlretrieve
# url = ('http://localhost:8501' + export_name[1:] + '.csv') url = ('http://localhost:8501' + export_name[1:] + '.csv')
# filename = export_name + '.csv' filename = export_name + '.csv'
# urlretrieve(url, filename) urlretrieve(url, filename)
# create a report with information on the prediction # create a report with information on the prediction
## see https://stackoverflow.com/a/59578663 ## see https://stackoverflow.com/a/59578663
if type(result) is list: if type(result) is list:
......
...@@ -193,4 +193,6 @@ def list_files(mypath, import_type): ...@@ -193,4 +193,6 @@ def list_files(mypath, import_type):
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
list_files = [f for f in listdir(mypath) if isfile(join(mypath, f)) and f.endswith(import_type + '.pkl')] list_files = [f for f in listdir(mypath) if isfile(join(mypath, f)) and f.endswith(import_type + '.pkl')]
if list_files == []:
list_files = ['Please, create a model before - no model available yet']
return list_files return list_files
\ No newline at end of file
...@@ -4,4 +4,5 @@ Pillow>=8.4.0 ...@@ -4,4 +4,5 @@ Pillow>=8.4.0
protobuf>=3.19.0 protobuf>=3.19.0
watchdog>=2.1.8 watchdog>=2.1.8
pinard>=1.0 pinard>=1.0
julia>=0.6.2 julia>=0.6.2
\ No newline at end of file plotly>=5.20.0
\ 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