mrbeliever commited on
Commit
e2109c6
·
verified ·
1 Parent(s): 8da2ebb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -8
app.py CHANGED
@@ -80,7 +80,11 @@ if uploaded_image and API_KEY:
80
  st.subheader("Generated Caption")
81
 
82
  # Use a text area for the caption so it can be copied easily
83
- caption_area = st.text_area("", caption, height=100, key="caption_area", disabled=True)
 
 
 
 
84
 
85
  # Add a copy button to copy the caption to clipboard
86
  copy_button = st.button("Copy Caption", use_container_width=True)
@@ -96,16 +100,53 @@ else:
96
  else:
97
  st.info("Please upload an image.")
98
 
99
- # Remove the sidebar and center the content
100
  st.markdown(
101
  """
102
  <style>
103
- .css-1d391kg {text-align: center;}
104
- .css-1v3fvcr {justify-content: center; display: flex;}
105
- .css-1y4ccs5 {margin: 0 auto;}
106
- .css-1aumxhk {display: flex; justify-content: center;}
107
- .css-1k6kn8p {justify-content: center; align-items: center; display: flex;}
108
- .css-ffhzg6 {text-align: center;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </style>
110
  """, unsafe_allow_html=True
111
  )
 
80
  st.subheader("Generated Caption")
81
 
82
  # Use a text area for the caption so it can be copied easily
83
+ caption_area = st.text_area(
84
+ "", caption, height=100, key="caption_area", disabled=True,
85
+ max_chars=2000, # Limit number of characters for better display
86
+ help="The generated caption will appear here.", label_visibility="collapsed"
87
+ )
88
 
89
  # Add a copy button to copy the caption to clipboard
90
  copy_button = st.button("Copy Caption", use_container_width=True)
 
100
  else:
101
  st.info("Please upload an image.")
102
 
103
+ # Customizing CSS for text area and button
104
  st.markdown(
105
  """
106
  <style>
107
+ /* Custom styles for the text area */
108
+ .css-1w6p6e5 {
109
+ background-color: #f0f0f5;
110
+ color: #333333;
111
+ font-size: 16px;
112
+ padding: 10px;
113
+ }
114
+
115
+ .stButton>button {
116
+ background-color: #4CAF50;
117
+ color: white;
118
+ font-size: 16px;
119
+ border: none;
120
+ border-radius: 4px;
121
+ padding: 10px;
122
+ cursor: pointer;
123
+ }
124
+
125
+ .stButton>button:hover {
126
+ background-color: #45a049;
127
+ }
128
+
129
+ .stTextArea>div>textarea {
130
+ background-color: #f5f5f5;
131
+ color: #333;
132
+ font-size: 14px;
133
+ padding: 10px;
134
+ border-radius: 5px;
135
+ }
136
+
137
+ .stTextArea>div>textarea:disabled {
138
+ background-color: #e0e0e0;
139
+ color: #666;
140
+ }
141
+
142
+ /* Centering elements */
143
+ .css-1v3fvcr {
144
+ justify-content: center;
145
+ display: flex;
146
+ }
147
+ .css-ffhzg6 {
148
+ text-align: center;
149
+ }
150
  </style>
151
  """, unsafe_allow_html=True
152
  )