Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -332,16 +332,17 @@ def main_app():
|
|
332 |
# Store image data in database
|
333 |
store_image_data_in_db(st.session_state.current_user, prompt, aspect_ratio, realism, cloud_storage_url, thumbnail_url)
|
334 |
st.success("Image stored to database successfully!")
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
else:
|
336 |
st.error("Failed to upload thumbnail to cloud storage.")
|
337 |
else:
|
338 |
st.error("Failed to create thumbnail")
|
339 |
|
340 |
-
st.image(image, caption="Generated Image", use_column_width=True) # Display high res image on top
|
341 |
-
|
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(f"Image generation failed: {image_result}")
|
347 |
else:
|
@@ -384,14 +385,19 @@ def main_app():
|
|
384 |
cols = st.columns(num_images_to_display)
|
385 |
for i, image_data in enumerate(images_for_window):
|
386 |
with cols[i]:
|
387 |
-
if image_data.get('thumbnail_url'):
|
388 |
-
|
389 |
-
st.
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
|
|
|
|
395 |
else:
|
396 |
st.image(image_data['image_url'], width = 150)
|
397 |
st.write(f"**Prompt:** {image_data['prompt']}")
|
|
|
332 |
# Store image data in database
|
333 |
store_image_data_in_db(st.session_state.current_user, prompt, aspect_ratio, realism, cloud_storage_url, thumbnail_url)
|
334 |
st.success("Image stored to database successfully!")
|
335 |
+
st.image(image, caption="Generated Image", use_column_width=True) # Display high res image on top
|
336 |
+
download_path = download_image(image_url)
|
337 |
+
if download_path:
|
338 |
+
st.download_button(label="Download Image", data = open(download_path, "rb"), file_name = f"image.png")
|
339 |
+
else:
|
340 |
+
st.error("Failed to upload image to cloud storage.")
|
341 |
else:
|
342 |
st.error("Failed to upload thumbnail to cloud storage.")
|
343 |
else:
|
344 |
st.error("Failed to create thumbnail")
|
345 |
|
|
|
|
|
|
|
|
|
|
|
346 |
else:
|
347 |
st.error(f"Image generation failed: {image_result}")
|
348 |
else:
|
|
|
385 |
cols = st.columns(num_images_to_display)
|
386 |
for i, image_data in enumerate(images_for_window):
|
387 |
with cols[i]:
|
388 |
+
if image_data.get('thumbnail_url') and image_data.get('image_url'):
|
389 |
+
with st.container():
|
390 |
+
if st.button("More", key = f"more_{i}"):
|
391 |
+
with st.container(border = True):
|
392 |
+
st.image(image_data['image_url'], use_column_width=True)
|
393 |
+
st.write(f"**Prompt:** {image_data['prompt']}")
|
394 |
+
st.write(f"**Aspect Ratio:** {image_data['aspect_ratio']}")
|
395 |
+
st.write(f"**Realism:** {image_data['realism']}")
|
396 |
+
download_path = download_image(image_data['image_url'])
|
397 |
+
if download_path:
|
398 |
+
st.download_button(label="Download Image", data = open(download_path, "rb"), file_name = f"image.png")
|
399 |
+
st.image(image_data['thumbnail_url'], width = 150) # display thumbnail
|
400 |
+
|
401 |
else:
|
402 |
st.image(image_data['image_url'], width = 150)
|
403 |
st.write(f"**Prompt:** {image_data['prompt']}")
|