Skip to content

Commit

Permalink
add img_to_bytes function
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedbesbes committed Apr 1, 2021
1 parent 50a5dde commit 55fd2c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion utils/functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path
import base64
import time
import streamlit as st
import pandas as pd
Expand Down Expand Up @@ -236,4 +238,10 @@ def display_kpis(train_metric, test_metric, label):
margin=dict(l=0, r=0, b=5, t=50, pad=0),
)

return fig
return fig


def img_to_bytes(img_path):
img_bytes = Path(img_path).read_bytes()
encoded = base64.b64encode(img_bytes).decode()
return encoded

0 comments on commit 55fd2c1

Please sign in to comment.