JeCabrera commited on
Commit
ff360f5
·
verified ·
1 Parent(s): 7c78814

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -25,14 +25,18 @@ def get_gemini_response(target_audience, product, product_mention, mood, length)
25
 
26
  # Crear el prompt completo basado en los campos del frontend
27
  full_prompt = f"""
28
- You are a creative writer skilled in the art of persuasion. Write a Historia of {length} words in Spanish language. The tone of the Historia should be {mood} and carefully crafted to emotionally resonate with a {target_audience}. {mention_instruction} {format_instruction} Use persuasive techniques to guide the reader towards an intuitive understanding of the product's benefits, focusing on creating a strong emotional connection with the audience.
29
  """
30
 
31
  response = model.generate_content([full_prompt])
32
 
33
  # Comprobar si la respuesta es válida y devolver el texto
34
  if response and response.parts:
35
- return response.parts[0].text
 
 
 
 
36
  else:
37
  raise ValueError("Lo sentimos, intenta con una combinación diferente de entradas.")
38
 
 
25
 
26
  # Crear el prompt completo basado en los campos del frontend
27
  full_prompt = f"""
28
+ You are a creative writer skilled in the art of persuasion. Write a story of {length} words in Spanish. The tone of the story should be {mood} and carefully crafted to emotionally resonate with a {target_audience}. {mention_instruction} {format_instruction} Use persuasive techniques to guide the reader towards an intuitive understanding of the product's benefits, focusing on creating a strong emotional connection with the audience.
29
  """
30
 
31
  response = model.generate_content([full_prompt])
32
 
33
  # Comprobar si la respuesta es válida y devolver el texto
34
  if response and response.parts:
35
+ # Formatear la respuesta en párrafos
36
+ text = response.parts[0].text
37
+ paragraphs = text.split("\n") # Suponiendo que los párrafos están separados por saltos de línea
38
+ formatted_text = "\n\n".join(paragraphs) # Unir los párrafos con dos saltos de línea
39
+ return formatted_text
40
  else:
41
  raise ValueError("Lo sentimos, intenta con una combinación diferente de entradas.")
42