ProfessorLeVesseur commited on
Commit
0747aac
·
verified ·
1 Parent(s): d54c618

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
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
- # uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
25
- uploaded_file = st.file_uploader(type=["jpg", "png", "jpeg"])
26
 
27
- # if uploaded_file:
28
- # # Display the uploaded image with specified width
29
- # image_width = 150 # Set the desired width in pixels
30
- # with st.expander("Image", expanded=True):
31
- # st.image(uploaded_file, caption=uploaded_file.name, width=image_width, use_column_width=False)
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.")