Skip to content

Commit

Permalink
Merge branch 'isee4xai:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusdarias authored Jun 7, 2024
2 parents 4bc926b + ff3ecfc commit cbd054c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions resources/explainers/tabular/lime.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,27 @@ def predict(X):
##saving

hti = Html2Image()
hti.output_path= os.getcwd()
# hti.output_path= os.getcwd()
hti.output_path= "/tmp"
size=(10, 4)
css="body {background: white;}"
if "png_height" in params_json and "png_width" in params_json:
size=(int(params_json["png_width"])/100,int(params_json["png_height"])/100)
hti.screenshot(html_str=explanation.as_html(),css_str=css, save_as="temp.png", size=size)
print("1")
print(explanation.as_html())
hti.screenshot(html_str=explanation.as_html(),css_str=css, save_as="temp.png", size=size)
print("2")
print(explanation.as_html())
else:
print("3")
print(explanation.as_html())
hti.screenshot(html_str=explanation.as_html(),css_str=css, save_as="temp.png",size=(1300,350))
print("4")
print(explanation.as_html())

im=Image.open("temp.png")
im=Image.open("/tmp/temp.png")
b64Image=PIL_to_base64(im)
os.remove("temp.png")
# os.remove("temp.png")

response={"type":"image","explanation":b64Image,"explanation_llm":json.loads(json.dumps(dict(explanation.as_list())))}
return response
Expand Down

0 comments on commit cbd054c

Please sign in to comment.