juan
SSolara
•Created by juan on 10/3/2024 in #questions-issues
CSV file as input?
Is there a way to input using FileDrop (or any other way) a CSV file and use it?
5 replies
SSolara
•Created by juan on 9/30/2024 in #questions-issues
Trying to show a shap plot with solara
This is the code for the image:
df_encoded is a global variable that has been updated in another function
#imports...
shap_image = solara.reactive(None)
def show_shap():
# Use the global reactive df_encoded_reactive variable
df_encoded = df_encoded_reactive.value
if df_encoded is None:
return # Prevent error if no prediction has been made yet
# SHAP values for user inputs
shap_values = explainer.shap_values(df_encoded)
shap.force_plot(explainer.expected_value, shap_values[0], df_encoded.iloc[0], matplotlib=True)
# Save SHAP plot to an image
buf = io.BytesIO()
plt.savefig(buf, format='png')
buf.seek(0)
shap_image.value = Image.open(buf)
then I wanna use a button that when clicked it displays it:
def Page():
solara.Button(label="More info", on_click=show_shap)
if shap_image.value:
solara.Markdown(shap_image.value)
My Solara interface displays the More Infor button, but when pressed, nothing happens although the function is working. I think the issue is with how I am trying to show the image.
Thank you
3 replies
SSolara
•Created by juan on 9/26/2024 in #questions-issues
Model Interaction Interface
Hello, has anyone done a Solara web app to interact with a ML model and get predictions based on some inputs?
If so, please text me or send me any information on how to proceed.
Thank you very much.
1 replies