JeCabrera commited on
Commit
de33a24
verified
1 Parent(s): c82a36c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -347,11 +347,16 @@ if submit_ad:
347
  if not isinstance(generated_ad, str):
348
  st.error("Error al generar el anuncio")
349
  else:
 
 
 
 
 
350
  # Display only the ad without separate headline and without storing in session state
351
  st.markdown(f"""
352
  <div style="{styles['results_container']}">
353
  <h3>Anuncio Generado:</h3>
354
- <p>{generated_ad}</p>
355
  </div>
356
  """, unsafe_allow_html=True)
357
 
@@ -363,7 +368,7 @@ if submit_ad:
363
  timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
364
 
365
  # Prepare content for download (without separate headline)
366
- download_content = f"{generated_ad}"
367
 
368
  # Bot贸n de descarga with timestamp in filename
369
  st.download_button(
 
347
  if not isinstance(generated_ad, str):
348
  st.error("Error al generar el anuncio")
349
  else:
350
+ # Clean the generated ad text to remove any random characters
351
+ # Remove any single letters that appear on their own line
352
+ cleaned_ad = "\n".join([line for line in generated_ad.split("\n")
353
+ if not (len(line.strip()) == 1 and line.strip().isalpha())])
354
+
355
  # Display only the ad without separate headline and without storing in session state
356
  st.markdown(f"""
357
  <div style="{styles['results_container']}">
358
  <h3>Anuncio Generado:</h3>
359
+ <p>{cleaned_ad}</p>
360
  </div>
361
  """, unsafe_allow_html=True)
362
 
 
368
  timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
369
 
370
  # Prepare content for download (without separate headline)
371
+ download_content = f"{cleaned_ad}"
372
 
373
  # Bot贸n de descarga with timestamp in filename
374
  st.download_button(