new version
Browse files
app.py
CHANGED
@@ -233,7 +233,7 @@ def run_fhe(user_id):
|
|
233 |
query["evaluation_key"] = encoded_evaluation_key
|
234 |
query["encrypted_encoding"] = encrypted_quantized_encoding
|
235 |
headers = {"Content-type": "application/json"}
|
236 |
-
|
237 |
if task == "0":
|
238 |
response = requests.post(
|
239 |
"http://localhost:8000/predict_HLM",
|
@@ -436,7 +436,6 @@ task_mapping_2 = {
|
|
436 |
}
|
437 |
|
438 |
|
439 |
-
|
440 |
unit_mapping = {
|
441 |
"0": "(mL/min/kg)",
|
442 |
"1": " ",
|
@@ -447,8 +446,6 @@ unit_mapping = {
|
|
447 |
}
|
448 |
|
449 |
|
450 |
-
|
451 |
-
|
452 |
task_options = list(task_mapping.values())
|
453 |
|
454 |
# Create the dropdown menu
|
@@ -636,7 +633,6 @@ if __name__ == "__main__":
|
|
636 |
)
|
637 |
st.toast("Session successfully completed!!!")
|
638 |
|
639 |
-
|
640 |
st.markdown("Is this a large, average or small value for this property? 🤔 Find out by comparing with the property distribution of the training dataset")
|
641 |
# now load the data from the pkl
|
642 |
with open("all_data.pkl", "rb") as f:
|
@@ -648,22 +644,29 @@ if __name__ == "__main__":
|
|
648 |
task_label_2 = task_mapping_2[st.session_state["task"]]
|
649 |
data = all_data[task_label_2]
|
650 |
|
651 |
-
|
652 |
# Create a histogram
|
653 |
-
fig = go.Figure(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
|
655 |
# If you don't have specific y-values for the vertical line, you can set them to ensure the line spans the plot.
|
656 |
# Here, we're assuming a static range. You might want to adjust these based on your dataset's characteristics.
|
657 |
max_y_value = np.max(np.histogram(data, bins=20)[0]) # Calculate the max height of the histogram bars
|
658 |
|
659 |
-
fig.add_trace(go.Scatter(x=[value, value], y=[0, max_y_value * 1.1], mode="lines", name="
|
660 |
|
661 |
# Update layout if necessary
|
662 |
fig.update_layout(
|
663 |
title="Comparison of the molecule's value with the distribution of the ADME dataset",
|
664 |
xaxis_title=task_label_2,
|
665 |
yaxis_title="Count",
|
666 |
-
bargap=0.2,
|
667 |
)
|
668 |
|
669 |
# Display the figure in the Streamlit app
|
@@ -671,9 +674,6 @@ if __name__ == "__main__":
|
|
671 |
else:
|
672 |
st.warning("Check if FHE computation has been done.")
|
673 |
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
with st.container():
|
678 |
st.subheader(f"Step 6 : Reset to predict a new molecule")
|
679 |
reset_button = st.button("Reset app", on_click=clear_session_state)
|
|
|
233 |
query["evaluation_key"] = encoded_evaluation_key
|
234 |
query["encrypted_encoding"] = encrypted_quantized_encoding
|
235 |
headers = {"Content-type": "application/json"}
|
236 |
+
|
237 |
if task == "0":
|
238 |
response = requests.post(
|
239 |
"http://localhost:8000/predict_HLM",
|
|
|
436 |
}
|
437 |
|
438 |
|
|
|
439 |
unit_mapping = {
|
440 |
"0": "(mL/min/kg)",
|
441 |
"1": " ",
|
|
|
446 |
}
|
447 |
|
448 |
|
|
|
|
|
449 |
task_options = list(task_mapping.values())
|
450 |
|
451 |
# Create the dropdown menu
|
|
|
633 |
)
|
634 |
st.toast("Session successfully completed!!!")
|
635 |
|
|
|
636 |
st.markdown("Is this a large, average or small value for this property? 🤔 Find out by comparing with the property distribution of the training dataset")
|
637 |
# now load the data from the pkl
|
638 |
with open("all_data.pkl", "rb") as f:
|
|
|
644 |
task_label_2 = task_mapping_2[st.session_state["task"]]
|
645 |
data = all_data[task_label_2]
|
646 |
|
|
|
647 |
# Create a histogram
|
648 |
+
fig = go.Figure(
|
649 |
+
go.Histogram(
|
650 |
+
x=data,
|
651 |
+
nbinsx=20,
|
652 |
+
marker_color="blue",
|
653 |
+
opacity=0.5,
|
654 |
+
name="ADME dataset",
|
655 |
+
)
|
656 |
+
)
|
657 |
|
658 |
# If you don't have specific y-values for the vertical line, you can set them to ensure the line spans the plot.
|
659 |
# Here, we're assuming a static range. You might want to adjust these based on your dataset's characteristics.
|
660 |
max_y_value = np.max(np.histogram(data, bins=20)[0]) # Calculate the max height of the histogram bars
|
661 |
|
662 |
+
fig.add_trace(go.Scatter(x=[value, value], y=[0, max_y_value * 1.1], mode="lines", name="Prediction", line=dict(color="red", dash="dash")))
|
663 |
|
664 |
# Update layout if necessary
|
665 |
fig.update_layout(
|
666 |
title="Comparison of the molecule's value with the distribution of the ADME dataset",
|
667 |
xaxis_title=task_label_2,
|
668 |
yaxis_title="Count",
|
669 |
+
bargap=0.2,
|
670 |
)
|
671 |
|
672 |
# Display the figure in the Streamlit app
|
|
|
674 |
else:
|
675 |
st.warning("Check if FHE computation has been done.")
|
676 |
|
|
|
|
|
|
|
677 |
with st.container():
|
678 |
st.subheader(f"Step 6 : Reset to predict a new molecule")
|
679 |
reset_button = st.button("Reset app", on_click=clear_session_state)
|