Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,13 @@ st.subheader(':green[_Image Alt Text Generator_]')
|
|
| 21 |
openai.api_key = st.secrets["openai_api_key"]
|
| 22 |
|
| 23 |
# File uploader allows user to add their own image
|
| 24 |
-
|
| 25 |
-
uploaded_file = st.file_uploader(type=["jpg", "png", "jpeg"])
|
| 26 |
|
| 27 |
-
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
# Toggle for showing additional details input
|
| 34 |
show_details = st.toggle("Add details about the image. ", value=False)
|
|
@@ -134,10 +133,4 @@ if uploaded_file is not None and analyze_button:
|
|
| 134 |
else:
|
| 135 |
# Warnings for user action required
|
| 136 |
if not uploaded_file and analyze_button:
|
| 137 |
-
st.warning("Please upload an image.")
|
| 138 |
-
|
| 139 |
-
if uploaded_file:
|
| 140 |
-
# Display the uploaded image with specified width
|
| 141 |
-
image_width = 150 # Set the desired width in pixels
|
| 142 |
-
with st.expander("Image", expanded=True):
|
| 143 |
-
st.image(uploaded_file, caption=uploaded_file.name, width=image_width, use_column_width=False)
|
|
|
|
| 21 |
openai.api_key = st.secrets["openai_api_key"]
|
| 22 |
|
| 23 |
# File uploader allows user to add their own image
|
| 24 |
+
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
|
|
|
| 25 |
|
| 26 |
+
if uploaded_file:
|
| 27 |
+
# Display the uploaded image with specified width
|
| 28 |
+
image_width = 150 # Set the desired width in pixels
|
| 29 |
+
with st.expander("Image", expanded=True):
|
| 30 |
+
st.image(uploaded_file, caption=uploaded_file.name, width=image_width, use_column_width=False)
|
| 31 |
|
| 32 |
# Toggle for showing additional details input
|
| 33 |
show_details = st.toggle("Add details about the image. ", value=False)
|
|
|
|
| 133 |
else:
|
| 134 |
# Warnings for user action required
|
| 135 |
if not uploaded_file and analyze_button:
|
| 136 |
+
st.warning("Please upload an image.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|