witchEverly commited on
Commit
a83b821
·
verified ·
1 Parent(s): 04b8500

Update pages/📸_InstaMuse.py

Browse files
Files changed (1) hide show
  1. pages/📸_InstaMuse.py +12 -10
pages/📸_InstaMuse.py CHANGED
@@ -54,6 +54,9 @@ with st.sidebar:
54
  # Main page content
55
  st.markdown('<p class="big-font">InstaMuse Photo Caption Generator</p>', unsafe_allow_html=True)
56
  st.write("### Upload your photo below and spark some caption magic! ଘ(੭ˊᵕˋ)੭* ੈ✩‧₊")
 
 
 
57
 
58
  # Upload image file and process image
59
  file = st.file_uploader(
@@ -66,16 +69,6 @@ if file:
66
  image = Image.open(file)
67
  image.thumbnail((600, 600), Image.Resampling.LANCZOS)
68
 
69
- try:
70
- desc = caption_generator.image_2_text(image)
71
- captions, caption_list, img_description = caption_generator.text_2_caption(desc)
72
- st.session_state['captions'] = captions
73
- st.session_state['caption_list'] = caption_list
74
- st.session_state['img_description'] = img_description
75
- except Exception as e:
76
- st.error(f"Error generating captions: {e}")
77
- captions = None
78
-
79
  with st.spinner(r'#### :sparkles: :sparkles: Generating... please wait :hourglass_flowing_sand:'):
80
  st.session_state['file'] = file
81
 
@@ -85,6 +78,15 @@ if file:
85
  with col1:
86
  st.markdown("## 📸 Your Image:")
87
  st.image(image, caption='Uploaded Image', use_column_width=True)
 
 
 
 
 
 
 
 
 
88
 
89
  with col2:
90
  if captions:
 
54
  # Main page content
55
  st.markdown('<p class="big-font">InstaMuse Photo Caption Generator</p>', unsafe_allow_html=True)
56
  st.write("### Upload your photo below and spark some caption magic! ଘ(੭ˊᵕˋ)੭* ੈ✩‧₊")
57
+ st.write(
58
+ '**Notice**: *The first time you upload an image, it may take longer to generate captions.*\n*Subsequent uploads will be faster.*')
59
+
60
 
61
  # Upload image file and process image
62
  file = st.file_uploader(
 
69
  image = Image.open(file)
70
  image.thumbnail((600, 600), Image.Resampling.LANCZOS)
71
 
 
 
 
 
 
 
 
 
 
 
72
  with st.spinner(r'#### :sparkles: :sparkles: Generating... please wait :hourglass_flowing_sand:'):
73
  st.session_state['file'] = file
74
 
 
78
  with col1:
79
  st.markdown("## 📸 Your Image:")
80
  st.image(image, caption='Uploaded Image', use_column_width=True)
81
+ try:
82
+ desc = caption_generator.image_2_text(image)
83
+ captions, caption_list, img_description = caption_generator.text_2_caption(desc)
84
+ st.session_state['captions'] = captions
85
+ st.session_state['caption_list'] = caption_list
86
+ st.session_state['img_description'] = img_description
87
+ except Exception as e:
88
+ st.error(f"Error generating captions: {e}")
89
+ captions = None
90
 
91
  with col2:
92
  if captions: