Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -334,10 +334,14 @@ def main_app():
|
|
334 |
# Store image data in database
|
335 |
store_image_data_in_db(st.session_state.current_user, prompt, aspect_ratio, realism, cloud_storage_url, thumbnail_url)
|
336 |
st.success("Image stored to database successfully!")
|
337 |
-
st.
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
341 |
else:
|
342 |
st.error("Failed to upload image to cloud storage.")
|
343 |
else:
|
@@ -393,8 +397,8 @@ def main_app():
|
|
393 |
if image_data.get('thumbnail_url') and image_data.get('image_url'):
|
394 |
if st.button("More", key = f"more_{i}"):
|
395 |
st.session_state.selected_image = image_data
|
396 |
-
|
397 |
-
|
398 |
else:
|
399 |
st.image(image_data['image_url'], width = 150)
|
400 |
st.write(f"**Prompt:** {image_data['prompt']}")
|
@@ -407,7 +411,7 @@ def main_app():
|
|
407 |
|
408 |
# Display modal if an image is selected
|
409 |
if st.session_state.selected_image:
|
410 |
-
|
411 |
st.image(st.session_state.selected_image['image_url'], use_column_width=True)
|
412 |
st.write(f"**Prompt:** {st.session_state.selected_image['prompt']}")
|
413 |
st.write(f"**Aspect Ratio:** {st.session_state.selected_image['aspect_ratio']}")
|
@@ -415,13 +419,13 @@ def main_app():
|
|
415 |
download_path = download_image(st.session_state.selected_image['image_url'])
|
416 |
if download_path:
|
417 |
st.download_button(label="Download Image", data = open(download_path, "rb"), file_name = f"image.png")
|
418 |
-
|
|
|
419 |
st.session_state.selected_image = None # close the modal when "close" is clicked
|
420 |
|
421 |
# Logout button
|
422 |
if st.button("Logout", on_click=logout_callback):
|
423 |
pass
|
424 |
-
# Render the appropriate screen based on login status
|
425 |
if st.session_state.logged_in:
|
426 |
main_app()
|
427 |
else:
|
|
|
334 |
# Store image data in database
|
335 |
store_image_data_in_db(st.session_state.current_user, prompt, aspect_ratio, realism, cloud_storage_url, thumbnail_url)
|
336 |
st.success("Image stored to database successfully!")
|
337 |
+
with st.container(border=True):
|
338 |
+
st.image(image, use_column_width=True) # Display high res image on top
|
339 |
+
st.write(f"**Prompt:** {prompt}")
|
340 |
+
st.write(f"**Aspect Ratio:** {aspect_ratio}")
|
341 |
+
st.write(f"**Realism:** {realism}")
|
342 |
+
download_path = download_image(image_url)
|
343 |
+
if download_path:
|
344 |
+
st.download_button(label="Download Image", data = open(download_path, "rb"), file_name = f"image.png")
|
345 |
else:
|
346 |
st.error("Failed to upload image to cloud storage.")
|
347 |
else:
|
|
|
397 |
if image_data.get('thumbnail_url') and image_data.get('image_url'):
|
398 |
if st.button("More", key = f"more_{i}"):
|
399 |
st.session_state.selected_image = image_data
|
400 |
+
st.image(image_data['thumbnail_url'], width = 150) #display thumbnail
|
401 |
+
|
402 |
else:
|
403 |
st.image(image_data['image_url'], width = 150)
|
404 |
st.write(f"**Prompt:** {image_data['prompt']}")
|
|
|
411 |
|
412 |
# Display modal if an image is selected
|
413 |
if st.session_state.selected_image:
|
414 |
+
with st.container(border = True):
|
415 |
st.image(st.session_state.selected_image['image_url'], use_column_width=True)
|
416 |
st.write(f"**Prompt:** {st.session_state.selected_image['prompt']}")
|
417 |
st.write(f"**Aspect Ratio:** {st.session_state.selected_image['aspect_ratio']}")
|
|
|
419 |
download_path = download_image(st.session_state.selected_image['image_url'])
|
420 |
if download_path:
|
421 |
st.download_button(label="Download Image", data = open(download_path, "rb"), file_name = f"image.png")
|
422 |
+
|
423 |
+
if st.button("Close"):
|
424 |
st.session_state.selected_image = None # close the modal when "close" is clicked
|
425 |
|
426 |
# Logout button
|
427 |
if st.button("Logout", on_click=logout_callback):
|
428 |
pass
|
|
|
429 |
if st.session_state.logged_in:
|
430 |
main_app()
|
431 |
else:
|