|
|
|
|
@ -111,6 +111,8 @@ if st.session_state.report_html != '': |
|
|
|
|
|
|
|
|
|
# Check if 'upload_image' is set to True in the session state |
|
|
|
|
if st.session_state.upload_image: |
|
|
|
|
import base64 |
|
|
|
|
from io import BytesIO |
|
|
|
|
# Initialize user_input to None |
|
|
|
|
user_input = None |
|
|
|
|
# Create a file uploader widget that accepts png, jpg, and jpeg files |
|
|
|
|
@ -122,7 +124,13 @@ if st.session_state.upload_image: |
|
|
|
|
# Open the image file and convert it to a numpy array and store the image array in the report object |
|
|
|
|
image = Image.open(img_file) |
|
|
|
|
img_array = np.array(image) |
|
|
|
|
report.image = img_array |
|
|
|
|
|
|
|
|
|
# Convert the image to Base64 |
|
|
|
|
buffered = BytesIO() |
|
|
|
|
image.save(buffered, format="JPEG") |
|
|
|
|
img_str = base64.b64encode(buffered.getvalue()).decode() |
|
|
|
|
|
|
|
|
|
report.image = img_str |
|
|
|
|
send('Thanks!', check=False, add_to_memory=False) |
|
|
|
|
# Ask the chatbot for more information and store the question |
|
|
|
|
question = chatbot.ask_for_info(report, chatbot=chatbot) |
|
|
|
|
|