mrbeliever commited on
Commit
8aa1ea9
·
verified ·
1 Parent(s): 45f5c71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -62,7 +62,7 @@ if uploaded_image and API_KEY:
62
  st.image(image, caption="Uploaded Image", use_container_width=True)
63
 
64
  if st.button("Generate Image", use_container_width=True):
65
- st.write("Generating...")
66
  result = generate_caption(image_base64, API_KEY)
67
 
68
  if "error" in result:
@@ -77,7 +77,14 @@ if uploaded_image and API_KEY:
77
  st.image(image_url, caption="Generated Image", use_container_width=True)
78
 
79
  # Download button for the generated image
80
- st.markdown(f"[Download Image]({image_url})", unsafe_allow_html=True)
 
 
 
 
 
 
 
81
 
82
  except Exception as e:
83
  st.error(f"Error processing the response: {e}")
 
62
  st.image(image, caption="Uploaded Image", use_container_width=True)
63
 
64
  if st.button("Generate Image", use_container_width=True):
65
+ st.write("Wait AI Is Generating Image...")
66
  result = generate_caption(image_base64, API_KEY)
67
 
68
  if "error" in result:
 
77
  st.image(image_url, caption="Generated Image", use_container_width=True)
78
 
79
  # Download button for the generated image
80
+ st.download_button(
81
+ label="Download Image",
82
+ data=requests.get(image_url).content, # Fetch the image data
83
+ file_name="generated_image.png",
84
+ mime="image/png",
85
+ use_container_width=True
86
+ )
87
+
88
 
89
  except Exception as e:
90
  st.error(f"Error processing the response: {e}")