Upload 9 files
Browse files- app.py +35 -2
- styles/main.css +1 -2
app.py
CHANGED
@@ -234,8 +234,32 @@ Create {number_of_emails} emails that faithfully follow the style and structure
|
|
234 |
|
235 |
return response.text
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
# Configurar la interfaz de usuario con Streamlit
|
238 |
-
st.set_page_config(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
# Leer el contenido del archivo manual.md
|
241 |
with open("manual.md", "r", encoding="utf-8") as file:
|
@@ -266,6 +290,12 @@ with col1:
|
|
266 |
# Move "Acción deseada" outside the accordion
|
267 |
desired_action = st.text_input("Acción deseada", placeholder="Ejemplo: Registrarse para una prueba gratuita")
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
# Only one submit button with a unique key
|
270 |
submit = st.button("Generar Emails", key="generate_emails_button")
|
271 |
|
@@ -399,6 +429,9 @@ if submit:
|
|
399 |
desired_action,
|
400 |
creative_idea # Add the creative idea parameter
|
401 |
)
|
|
|
|
|
|
|
402 |
|
403 |
# Display the generated emails in col2 (still within col2 context)
|
404 |
st.markdown(f"""
|
@@ -408,7 +441,7 @@ if submit:
|
|
408 |
</div>
|
409 |
""", unsafe_allow_html=True)
|
410 |
|
411 |
-
# Add download button
|
412 |
import datetime
|
413 |
|
414 |
# Get current timestamp for the filename
|
|
|
234 |
|
235 |
return response.text
|
236 |
|
237 |
+
# Define the clean_response_text function before it's used
|
238 |
+
def clean_response_text(text):
|
239 |
+
"""Remove extra spaces and normalize whitespace in the response text"""
|
240 |
+
import re
|
241 |
+
# Replace multiple newlines with just two
|
242 |
+
text = re.sub(r'\n{3,}', '\n\n', text)
|
243 |
+
# Remove leading/trailing whitespace
|
244 |
+
text = text.strip()
|
245 |
+
return text
|
246 |
+
|
247 |
# Configurar la interfaz de usuario con Streamlit
|
248 |
+
st.set_page_config(
|
249 |
+
page_title="Email Composer",
|
250 |
+
layout="wide",
|
251 |
+
menu_items={}, # Empty dict removes the three-dot menu
|
252 |
+
initial_sidebar_state="expanded"
|
253 |
+
)
|
254 |
+
|
255 |
+
# Add custom CSS to reduce margins
|
256 |
+
st.markdown("""
|
257 |
+
<style>
|
258 |
+
.main > div {
|
259 |
+
padding-top: 1rem;
|
260 |
+
}
|
261 |
+
</style>
|
262 |
+
""", unsafe_allow_html=True)
|
263 |
|
264 |
# Leer el contenido del archivo manual.md
|
265 |
with open("manual.md", "r", encoding="utf-8") as file:
|
|
|
290 |
# Move "Acción deseada" outside the accordion
|
291 |
desired_action = st.text_input("Acción deseada", placeholder="Ejemplo: Registrarse para una prueba gratuita")
|
292 |
|
293 |
+
# Move formula selection here, right after desired action
|
294 |
+
selected_formula_key = st.selectbox(
|
295 |
+
"Selecciona una fórmula para tus emails",
|
296 |
+
options=list(email_formulas.email_formulas.keys())
|
297 |
+
)
|
298 |
+
|
299 |
# Only one submit button with a unique key
|
300 |
submit = st.button("Generar Emails", key="generate_emails_button")
|
301 |
|
|
|
429 |
desired_action,
|
430 |
creative_idea # Add the creative idea parameter
|
431 |
)
|
432 |
+
|
433 |
+
# Clean the response text to remove extra spaces
|
434 |
+
generated_emails = clean_response_text(generated_emails)
|
435 |
|
436 |
# Display the generated emails in col2 (still within col2 context)
|
437 |
st.markdown(f"""
|
|
|
441 |
</div>
|
442 |
""", unsafe_allow_html=True)
|
443 |
|
444 |
+
# Add download button (styling is in styles/main.css)
|
445 |
import datetime
|
446 |
|
447 |
# Get current timestamp for the filename
|
styles/main.css
CHANGED
@@ -65,7 +65,6 @@ div.stButton > button:hover {
|
|
65 |
.results-container p i {
|
66 |
font-size: 1rem;
|
67 |
}
|
68 |
-
|
69 |
/* Download button styling */
|
70 |
.stDownloadButton button {
|
71 |
background: linear-gradient(to right, #FFD700, #FFA500);
|
@@ -75,4 +74,4 @@ div.stButton > button:hover {
|
|
75 |
width: 80%;
|
76 |
margin: 0 auto;
|
77 |
display: block;
|
78 |
-
}
|
|
|
65 |
.results-container p i {
|
66 |
font-size: 1rem;
|
67 |
}
|
|
|
68 |
/* Download button styling */
|
69 |
.stDownloadButton button {
|
70 |
background: linear-gradient(to right, #FFD700, #FFA500);
|
|
|
74 |
width: 80%;
|
75 |
margin: 0 auto;
|
76 |
display: block;
|
77 |
+
}
|